On Mon, 17 Apr 2006, Paul Johnson wrote: > Dear R-helpers: > > We have had fun using betareg to fit models with proportions as > dependent variables. > > However, in the analysis of these models we found some wrinkles and > don't know where is the best place to start looking for a fix. > > The problems we see (so far) are that > > 1. predict ignores newdata
The reason for this is that predict.betareg() does not take a newdate argument, you need to use the terms argument instead. > 2. anova does not work ...because there is no anova() method for betareg objects. I think it is owrth addressing both issues in betareg, I'll write to you and Alexandre (the package maintainer) off-list. Z > Here is the small working example: > > ---------------------------- > x <- c(1, 3, 1, 4, 5, 3, 5, 2, 5, 2) > y <- c(.3, .4, .4, .5, , .7, .4, .3, .4, .3, .5) > x2 <- c( 4, 2, 1, 5, 1, 2, 4, 2, 1, 3) > library(betareg) > mybreg <- betareg(y~x) > summary(mybreg) > > predict(mybreg, newdata=data.frame(x=c(2,2))) > > mybreg2 <- betareg(y~x+x2) > summary(mybreg) > anova(mybreg, mybreg2) > > ------------------------------- > Example output: > > > predict(mybreg, newdata=data.frame(x=c(2,2))) > [1] 0.3903155 0.4207632 0.3903155 0.4362319 0.4518258 0.4207632 0.4518258 > [8] 0.4054484 0.4518258 0.4054484 > ... > > anova(mybreg, mybreg2) > Error in as.double.default(lapply(objects, df.residual)) : > (list) object cannot be coerced to 'double' > > I have been digging in this a little bit and notice betareg does not > return the log likelihood at the maximum likelihood estimates, but I > am able to hack the file /usr/lib/R/library/betareg/R/betareg and save > the "value" of the optim function and print that out, so at least I > can do a likelihood-ratio test by hand in place of the anova. But I'm > stumped on why the predict ignores newdata. > > I'm using R-2.1.1 on Fedora Core Linux 5 with the betareg package from CRAN. > > In case you are interested in betareg, we have found this article to > be extremely readable and helpful: FERRARI, S.L.P., CRIBARI-NETO, F. > (2004). Beta regression for modeling rates and proportions. Journal > of Applied Statistics, v. 31, n. 7, p. 799-815. > > > -- > Paul E. Johnson > Professor, Political Science > 1541 Lilac Lane, Room 504 > University of Kansas > > ______________________________________________ > [email protected] mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html > ______________________________________________ [email protected] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
