Hello, I want to determine the regression relationship between a proportion (y) and a continuous variable (x). Reading a number of sources (e.g. The R Book, Quick R,help), I believe I should be able to designate the model as: model<-glm(formula=proportion~x, family=binomial(link="logit")) this runs but gives me error messages: Warning message: In eval(expr, envir, enclos) : non-integer #successes in a binomial glm! If I transform the proportion variable with log, it doesn't like that either (values not: 0<y<1) I understand that the binomial function concerns successes vs. failures and can use those raw data, but the R Book and other sources seem to suggest that proportion data are usable as well. Not so? Thank you, Georgiana May [[alternative HTML version deleted]]
The logit link requires a binary response variable, not a proportion. Better bet is a beta regression. You can also do some stuff with linear regression if you do some transformations, but linear regression assumes the outcome is any number on the real number line bounded between -Inf and Inf.> -----Original Message----- > From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On > Behalf Of Georgiana May > Sent: Monday, March 19, 2012 10:06 AM > To: r-help at r-project.org > Subject: [R] regression with proportion data > > Hello, > I want to determine the regression relationship between a proportion (y) > and a continuous variable (x). > Reading a number of sources (e.g. The R Book, Quick R,help), I believe I > should be able to designate the model as: > > model<-glm(formula=proportion~x, family=binomial(link="logit")) > > this runs but gives me error messages: > Warning message: > In eval(expr, envir, enclos) : non-integer #successes in a binomial glm! > > If I transform the proportion variable with log, it doesn't like that > either (values not: 0<y<1) > > I understand that the binomial function concerns successes vs. failures and > can use those raw data, but the R Book and other sources seem to suggest > that proportion data are usable as well. Not so? > > Thank you, > Georgiana May > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at 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.
Your response variable is not binomial, it's a proportion. Try the betareg function in the betareg package, which more correctly assumes that your response variable is Beta distributed (but beware that 1 and 0 are not allowed). The syntax is the same as in a glm. HTH Ruben -----Mensaje original----- De: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] En nombre de Georgiana May Enviado el: lunes, 19 de marzo de 2012 15:06 Para: r-help at r-project.org Asunto: [R] regression with proportion data Hello, I want to determine the regression relationship between a proportion (y) and a continuous variable (x). Reading a number of sources (e.g. The R Book, Quick R,help), I believe I should be able to designate the model as: model<-glm(formula=proportion~x, family=binomial(link="logit")) this runs but gives me error messages: Warning message: In eval(expr, envir, enclos) : non-integer #successes in a binomial glm! If I transform the proportion variable with log, it doesn't like that either (values not: 0<y<1) I understand that the binomial function concerns successes vs. failures and can use those raw data, but the R Book and other sources seem to suggest that proportion data are usable as well. Not so? Thank you, Georgiana May [[alternative HTML version deleted]] ______________________________________________ R-help at 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.
Hi Georgiana, Take a look at the betareg package at http://cran.r-project.org/web/packages/betareg/index.html HTH, Jorge.- On Mon, Mar 19, 2012 at 10:05 AM, Georgiana May <> wrote:> Hello, > I want to determine the regression relationship between a proportion (y) > and a continuous variable (x). > Reading a number of sources (e.g. The R Book, Quick R,help), I believe I > should be able to designate the model as: > > model<-glm(formula=proportion~x, family=binomial(link="logit")) > > this runs but gives me error messages: > Warning message: > In eval(expr, envir, enclos) : non-integer #successes in a binomial glm! > > If I transform the proportion variable with log, it doesn't like that > either (values not: 0<y<1) > > I understand that the binomial function concerns successes vs. failures and > can use those raw data, but the R Book and other sources seem to suggest > that proportion data are usable as well. Not so? > > Thank you, > Georgiana May > > [[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. >[[alternative HTML version deleted]]
> -----Original Message----- > From: r-help-bounces at r-project.org > [mailto:r-help-bounces at r-project.org] On Behalf Of Georgiana May > Sent: 19 March 2012 14:06 > To: r-help at r-project.org > Subject: [R] regression with proportion data > > I understand that the binomial function concerns successes > vs. failures and can use those raw data, but the R Book and > other sources seem to suggest that proportion data are usable > as well. Not so?You _can_ use a two-column matrix with counts of successes and failures in the two columns And if you know what the number n of observations was (which you would need to anyway for using proportions in a logistic regression) youcan calculate that matrix from the proportions and n, as long as you're reasonably careful about rounf=ding. S Ellison******************************************************************* This email and any attachments are confidential. Any use...{{dropped:8}}