[R] betareg question - keeping the mean fixed?

Bettina Gruen Bettina.Gruen at jku.at
Thu Sep 1 15:24:35 CEST 2011


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 vector

If 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



More information about the R-help mailing list