[R] betareg help
Achim Zeileis
Achim.Zeileis at uibk.ac.at
Sun Mar 13 16:24:20 CET 2011
On Sat, 12 Mar 2011, Vlatka Matkovic Puljic wrote:
> Maybe I should include data:
As Ben said previously: The full data would have been more useful.
However, I've had a look at the response and even a regression with an
intercept only had the same problem.
R> betareg(cond ~ 1, data = results)
Error in optim(par = start, fn = loglikfun, gr = gradfun, method = method,
: initial value in 'vmmin' is not finite
The reason is that the estimate of the starting value of the precision
parameter is negative. I'll have a look at whether I can fix that in
betareg(). For the moment, please simply provide different starting
values, e.g., you could use the results from an OLS regression for the
mean and some constant for the precision parameter:
R> cf <- coef(lm(qlogis(cond) ~ 1, data = results))
R> betareg(cond ~ 1, data = results, start = list(mean = cf, precision = 1))
Call:
betareg(formula = cond ~ 1, data = results, start = list(mean = cf,
precision = 1))
Coefficients (mean model with logit link):
(Intercept)
-0.5829
Phi coefficients (precision model with identity link):
(phi)
1.145
The source of the negative precision estimate seems to stem from the large
amount of observations with the minimal value 0.001. I suspect that these
were zeros in the original coding. It may be worth to try a hurdle-type
model, i.e., adopt a two-part model: (1) model zeros-vs-non-zeros via a
glm(..., family = binomial). (2) model non-zeros only via betareg().
hth,
Z
> results$cond
> [1] 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001
> [13] 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001
> [25] 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001
> [37] 0.001 0.001 0.020 0.020 0.020 0.030 0.030 0.050 0.050 0.050 0.050 0.050
> [49] 0.050 0.050 0.050 0.050 0.060 0.060 0.060 0.070 0.070 0.070 0.070 0.080
> [61] 0.090 0.100 0.100 0.100 0.100 0.100 0.100 0.120 0.120 0.130 0.130 0.140
> [73] 0.160 0.160 0.170 0.170 0.180 0.180 0.200 0.200 0.210 0.210 0.210 0.220
> [85] 0.230 0.250 0.250 0.250 0.250 0.270 0.280 0.300 0.300 0.300 0.300 0.300
> [97] 0.310 0.320 0.330 0.340 0.350 0.350 0.350 0.360 0.400 0.430 0.430 0.450
> [109] 0.450 0.450 0.450 0.450 0.450 0.450 0.450 0.450 0.450 0.460 0.470
> 0.470
> [121] 0.470 0.470 0.480 0.490 0.490 0.500 0.500 0.500 0.500 0.500 0.500
> 0.500
> [133] 0.500 0.500 0.500 0.520 0.530 0.550 0.550 0.550 0.560 0.600 0.600
> 0.600
> [145] 0.600 0.600 0.620 0.640 0.650 0.650 0.650 0.650 0.660 0.680 0.680
> 0.680
> [157] 0.680 0.700 0.700 0.700 0.700 0.700 0.700 0.710 0.740 0.750 0.750
> 0.750
> [169] 0.750 0.760 0.760 0.770 0.780 0.800 0.800 0.800 0.800 0.800 0.810
> 0.820
> [181] 0.820 0.830 0.830 0.840 0.850 0.850 0.850 0.850 0.860 0.870 0.870
> 0.870
> [193] 0.900 0.900 0.900 0.900 0.900 0.910 0.920 0.920 0.930 0.930 0.950
> 0.950
> [205] 0.950 0.960 0.980 0.980 0.999
>
> 2011/3/12 Vlatka Matkovic Puljic <v.matkovic.puljic at gmail.com>
>
>> Dear R users,
>>
>> I'm trying to do betareg on my dataset.
>> Dependent variable is not normally distributed and is proportion (of condom
>> use (0,1)).
>> But I'm having problems:
>>
>> gyl<-betareg(cond ~ alcoh + drug, data=results)
>> Error in optim(par = start, fn = loglikfun, gr = gradfun, method = method,
>> :
>> initial value in 'vmmin' is not finite
>>
>> Why is R returning me error in optim()?
>> What should I do?
>>
>> In advance, thank you for advice!
>>
>>
>>
>>
>> --
>> **************************
>> Vlatka Matkovic Puljic
>> +32/ 485/ 453340
>>
>>
>
>
> --
> **************************
> Vlatka Matkovic Puljic
> +32/ 485/ 453340
>
> [[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.
>
More information about the R-help
mailing list