Hello, I have a dataset with proportions that vary around a fixed mean, is it possible to use betareg to look at variance in the dispersion parameter while keeping the mean fixed? I am very new to R but have tried the following: svec<-c(qlogis(mean(data1$scaled)),0,0,0) f<-betareg(scaled~-1 | expt_label + grouped_hpi, data=data1, link.phi="log", control=betareg.control(start=svec)) I understood that y~-1 could be used to give a fixed mean of 0.5 however I get the following error: Error in linkinv(x %*% beta + offset) : Argument eta must be a nonempty numeric vector I think I can work round this by using: svec2<-c(qlogis(mean(data1$scaled)),0,0,0,0,0) f2<-betareg(scaled ~ expt_label + grouped_hpi | expt_label + grouped_hpi, data=data1, + link.phi="log",control=betareg.control(start=svec2)) This appears to work (ie doesn't return errors), but given i know the mean to be fixed I would like to do this in the model (especially as my data set is small) - is this possible? Thanks in advance. -- View this message in context: http://r.789695.n4.nabble.com/betareg-question-keeping-the-mean-fixed-tp3783303p3783303.html Sent from the R help mailing list archive at Nabble.com.
Hi,> I have a dataset with proportions that vary around a fixed mean, is it > possible to use betareg to look at variance in the dispersion parameter > while keeping the mean fixed? > > I am very new to R but have tried the following: > > svec<-c(qlogis(mean(data1$scaled)),0,0,0) > f<-betareg(scaled~-1 | expt_label + grouped_hpi, data=data1, link.phi="log", > control=betareg.control(start=svec)) > > I understood that y~-1 could be used to give a fixed mean of 0.5 however I > get the following error: > Error in linkinv(x %*% beta + offset) : > Argument eta must be a nonempty numeric vectorIf you want to have a fixed mean, i.e., only fit an intercept, you need to specify it using y ~ 1 | exp_label + grouped_hpi. Including -1 in the formula on the right hand side makes only sense if you have other covariates included and explicitly want to exclude the intercept. HTH, Bettina -- ------------------------------------------------------------------- Bettina Gr?n Institut f?r Angewandte Statistik / IFAS Johannes Kepler Universit?t Linz Altenbergerstra?e 69 4040 Linz, Austria Tel: +43 732 2468-5889 Fax: +43 732 2468-9846 E-Mail:Bettina.Gruen at jku.at www.ifas.jku.at ------------------------------------------------------------------- -- ------------------------------------------------------------------- Bettina Gr?n Institut f?r Angewandte Statistik / IFAS Johannes Kepler Universit?t Linz Altenbergerstra?e 69 4040 Linz, Austria Tel: +43 732 2468-5889 Fax: +43 732 2468-9846 E-Mail: Bettina.Gruen at jku.at www.ifas.jku.at
Thanks for your response, that does work, however, it is still not quite what want. I would like to tell betareg what the mean is (in my case, 0.5) and force it to use that value. Is this possible? -- View this message in context: http://r.789695.n4.nabble.com/betareg-question-keeping-the-mean-fixed-tp3783303p3785683.html Sent from the R help mailing list archive at Nabble.com.
On 09/02/2011 07:20 PM, betty_d wrote:> Thanks for your response, that does work, however, it is still not quite what > want. I would like to tell betareg what the mean is (in my case, 0.5) and > force it to use that value. Is this possible?AFAIK package betareg currently does not allow you to fix the mean and only estimate the precision parameters. Best, Bettina -- ------------------------------------------------------------------- Bettina Gr?n Institut f?r Angewandte Statistik / IFAS Johannes Kepler Universit?t Linz Altenbergerstra?e 69 4040 Linz, Austria Tel: +43 732 2468-5889 Fax: +43 732 2468-9846 E-Mail: Bettina.Gruen at jku.at www.ifas.jku.at