[R] binomial logistic regression question
Patrick Breheny
patrick.breheny at uky.edu
Tue Sep 27 14:59:34 CEST 2011
On 09/27/2011 07:53 AM, majesty wrote:
> Dear subscribers,
>
> I am looking for a function which would allow me to model the dependent
> variable as the number of successes in a series of Bernoulli trials. My data
> looks like this
>
> ID TRIALS SUCCESSESS INDEP1 INDEP2 INDEP3
> 1 4444 0 0.273 0.055 0.156
> 2 98170 74 0.123 0.456 0.789
> 3 145486 30 0.124 0.235 0.007
> 4 147149 49 0.888 0.357 0.321
> 5 60585 11 0.484 0.235 0.235
> 6 198953 43 0.295 0.123 0.856
>
> I want to find out how independent variables influence the number of
> successful trials (dependent variable)
> I had tried to use glm formula
>
> regression.glm<- glm( SUCCESSESS ~ INDEP1 + INDEP2 + INDEP3, data = data,
> family = binomial, weights= TRIALS)
Try
regression.glm<- glm(cbind(SUCCESSESS,TRIALS) ~ INDEP1 + INDEP2 +
INDEP3, data = data,family = binomial)
as is specified in the details of ?glm.
--
Patrick Breheny
Assistant Professor
Department of Biostatistics
Department of Statistics
University of Kentucky
More information about the R-help
mailing list