[R] Error using betareg

Achim Zeileis Achim.Zeileis at uibk.ac.at
Fri Jun 24 12:22:30 CEST 2011


On Fri, 24 Jun 2011, oyvfos wrote:

> Dear all,
>
> I get an error using betrag on this data set
> :http://dl.dropbox.com/u/1866110/dump.csv.
> I run it like this
> regression f2.1=betareg(Y~X1+X2,data=dump)
> summary(f2.1)
>
> I get :
>
> Call:
> betareg(formula = Y ~ X1 + X2, data = dump)
>
> Standardized weighted residuals 2:
> Error in quantile.default(x$residuals) :
>  missing values and NaN's not allowed if 'na.rm' is FALSE
> In addition: Warning message:
> In sqrt(v * (1 - hatvalues(object))) : NaNs produced
>
> Does anybody know how to fix this?

I cannot replicate this. I get no error but the results below for R 2.13.0 
and betareg 2.3.0.

R> d <- read.table("http://dl.dropbox.com/u/1866110/dump.csv")
R> m <- betareg(Y ~ X1 + X2, data = d)
R> summary(m)

Call:
betareg(formula = Y ~ X1 + X2, data = d)

Standardized weighted residuals 2:
     Min      1Q  Median      3Q     Max
-1.2621 -0.5828 -0.1272  0.3490  3.5940

Coefficients (mean model with logit link):
               Estimate Std. Error z value Pr(>|z|)
(Intercept) -0.6830481  0.2697329  -2.532   0.0113 *
X1Y         -0.4199696  0.2657974  -1.580   0.1141
X2          -0.0003639  0.0001561  -2.331   0.0198 *

Phi coefficients (precision model with identity link):
       Estimate Std. Error z value Pr(>|z|)
(phi)  0.97087    0.04256   22.81   <2e-16 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Log-likelihood:  1820 on 4 Df
Pseudo R-squared: 0.01671
Number of iterations in BFGS optimization: 17

Your results suggest that something goes wrong in the computation of 
residuals. So you may try to use summary(m, type = "deviance") or 
summary(m, type = "pearson"). If these work, then you should look at 
residuals(m, type = "sweighted2") which is the default type of residuals. 
As these involve computations of quadratic (n x n) complexity, they may be 
numerically less stable compared to deviance or pearson residuals which 
just require computations of linear complexity.

hth,
Z



> Oyvind
>
>
>
> --
> View this message in context: http://r.789695.n4.nabble.com/Error-using-betareg-tp3621955p3621955.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> 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.
>



More information about the R-help mailing list