Hello everybody, I am trying to fit a logistic regression model by using glm() function in R. My response variable is a sample proportion NOT binary numbers(0,1). Regarding glm() function, I receive this error: non integer # successes in a binomial glm! I would appreciate if anybody conducts me. Regards, Pari [[alternative HTML version deleted]]
> On Jan 23, 2016, at 12:41 PM, pari hesabi <statistics84 at hotmail.com> wrote: > > Hello everybody, > > I am trying to fit a logistic regression model by using glm() function in R. My response variable is a sample proportion NOT binary numbers(0,1).So multiply the sample proportions (and 1-proportions) by the number of samples, round to integers, you will have an appropriate response variable and complements, and you can fit a binomial model.> > Regarding glm() function, I receive this error: non integer # successes in a binomial glm! > > I would appreciate if anybody conducts me. > > > Regards, > > Pari > > [[alternative HTML version deleted]]-- David Winsemius Alameda, CA, USA
Alternatively you might use log(p/1-p) as your dependent variable and use OLS with robust standard errors. Much of your inference would be analogous to a logistic regression John C Frain 3 Aranleigh Park Rathfarnham Dublin 14 Ireland www.tcd.ie/Economics/staff/frainj/home.html mailto:frainj at tcd.ie mailto:frainj at gmail.com On 23 January 2016 at 20:46, David Winsemius <dwinsemius at comcast.net> wrote:> > > On Jan 23, 2016, at 12:41 PM, pari hesabi <statistics84 at hotmail.com> > wrote: > > > > Hello everybody, > > > > I am trying to fit a logistic regression model by using glm() function > in R. My response variable is a sample proportion NOT binary numbers(0,1). > > So multiply the sample proportions (and 1-proportions) by the number of > samples, round to integers, you will have an appropriate response variable > and complements, and you can fit a binomial model. > > > > > Regarding glm() function, I receive this error: non integer # successes > in a binomial glm! > > > > I would appreciate if anybody conducts me. > > > > > > Regards, > > > > Pari > > > > [[alternative HTML version deleted]] > -- > > David Winsemius > Alameda, CA, USA > > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > 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. >[[alternative HTML version deleted]]
with glm(), you might try the quasi binomial family On Saturday, January 23, 2016, pari hesabi <statistics84 at hotmail.com> wrote:> Hello everybody, > > I am trying to fit a logistic regression model by using glm() function in > R. My response variable is a sample proportion NOT binary numbers(0,1). > > Regarding glm() function, I receive this error: non integer # successes > in a binomial glm! > > I would appreciate if anybody conducts me. > > > Regards, > > Pari > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org <javascript:;> mailing list -- To UNSUBSCRIBE and > more, see > 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. >-- WenSui Liu https://statcompute.wordpress.com/ [[alternative HTML version deleted]]
Do you have the sample sizes that the sample proportions were computed from (e.g. 0.5 could be 1 out of 2 or 100 out of 200)? If you do then you can specify the model with the proportions as the y variable and the corresponding sample sizes as the weights argument to glm. If you only have proportions without an integer sample size then you may want to switch to using beta regression instead of logistic regression. On Sat, Jan 23, 2016 at 1:41 PM, pari hesabi <statistics84 at hotmail.com> wrote:> Hello everybody, > > I am trying to fit a logistic regression model by using glm() function in R. My response variable is a sample proportion NOT binary numbers(0,1). > > Regarding glm() function, I receive this error: non integer # successes in a binomial glm! > > I would appreciate if anybody conducts me. > > > Regards, > > Pari > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > 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.-- Gregory (Greg) L. Snow Ph.D. 538280 at gmail.com
But beta can only be used to model the open interval between zero and one On Monday, January 25, 2016, Greg Snow <538280 at gmail.com> wrote:> Do you have the sample sizes that the sample proportions were computed > from (e.g. 0.5 could be 1 out of 2 or 100 out of 200)? > > If you do then you can specify the model with the proportions as the y > variable and the corresponding sample sizes as the weights argument to > glm. > > If you only have proportions without an integer sample size then you > may want to switch to using beta regression instead of logistic > regression. > > On Sat, Jan 23, 2016 at 1:41 PM, pari hesabi <statistics84 at hotmail.com > <javascript:;>> wrote: > > Hello everybody, > > > > I am trying to fit a logistic regression model by using glm() function > in R. My response variable is a sample proportion NOT binary numbers(0,1). > > > > Regarding glm() function, I receive this error: non integer # successes > in a binomial glm! > > > > I would appreciate if anybody conducts me. > > > > > > Regards, > > > > Pari > > > > [[alternative HTML version deleted]] > > > > ______________________________________________ > > R-help at r-project.org <javascript:;> mailing list -- To UNSUBSCRIBE and > more, see > > 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. > > > > -- > Gregory (Greg) L. Snow Ph.D. > 538280 at gmail.com <javascript:;> > > ______________________________________________ > R-help at r-project.org <javascript:;> mailing list -- To UNSUBSCRIBE and > more, see > 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. >-- WenSui Liu https://statcompute.wordpress.com/ [[alternative HTML version deleted]]