[R] Specifying Prior Weights in a GLM

Enrique Garcia eckomorph at yahoo.com
Sat Dec 11 17:59:15 CET 2010


Hello R folks,

I have three questions. I am trying to run a logistic regression (binomial
family) where the response variable is a proportion.  According to R
Documentation in "a binomial GLM prior weights are used to give the number
of trials when the response is the proportion of successes."  However when I
run my code I get the following error message:

Error in model.frame.default(formula = PER_ELA ~ A_EX + COMM + ENG + S_R + 
: 
  variable lengths differ (found for '(weights)')

I'm not sure what I am doing wrong.  My response variable is Y/M, which is
the proportion of 1's (successes) among M binary responses.  My prior weight
is a variable indicating the number of trials for each observation.  


This is an abbreviated version of the code that I ran: 

glm1<-glm(PER_ELA~A_EX .... PER_LEA,
family=binomial(link="logit"),data=data2,weights="REG")


Question 1 and 2:
Does the number of trials for each observation in my dataset have to be the
same? What am I doing wrong here?


Question 3:
Is it OK for me to use percentages as predictor variables in a logistic
regression? 

-- 
View this message in context: http://r.789695.n4.nabble.com/Specifying-Prior-Weights-in-a-GLM-tp3083480p3083480.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list