On Tue, Sep 27, 2011 at 2:59 PM, Patrick Breheny <patrick.breh...@uky.edu>wrote:
> 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) > > That should be regression.glm <- glm(cbind(SUCCESSESS,TRIALS - SUCCESSESS) ~ INDEP1 + INDEP2 + INDEP3, data = data,family = binomial) i.e., the second column in the response is the number of failures. as is specified in the details of ?glm. > > -- > Patrick Breheny > Assistant Professor > Department of Biostatistics > Department of Statistics > University of Kentucky > > > ______________________________**________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/**listinfo/r-help<https://stat.ethz.ch/mailman/listinfo/r-help> > PLEASE do read the posting guide http://www.R-project.org/** > posting-guide.html <http://www.R-project.org/posting-guide.html> > and provide commented, minimal, self-contained, reproducible code. > -- Göran Broström [[alternative HTML version deleted]]
______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.