Hi Statalist,
Wanted to pass on a way to fix bug for the -r2c- command on SSC for interested users.
The issue is related to the change in Stata V15 when equation names in the e(b) matrix for models like [g]nbreg changed from ln[alpha/delta]:_cons to /:ln[alpha/delta]. This breaks the API in -r2c-.
The command was developed in Stata V11 and has not been updated (and may not be) for some time. If users would like to use the -r2c- command, I recommend calling the command using a version 14: prefix.
Please see a reproducible example outlining the problem below. The first nbreg run works fine (in version 14); the second produces an error.
Thanks to Federico Tedeschi for reporting on this bug.
- joe
Wanted to pass on a way to fix bug for the -r2c- command on SSC for interested users.
The issue is related to the change in Stata V15 when equation names in the e(b) matrix for models like [g]nbreg changed from ln[alpha/delta]:_cons to /:ln[alpha/delta]. This breaks the API in -r2c-.
The command was developed in Stata V11 and has not been updated (and may not be) for some time. If users would like to use the -r2c- command, I recommend calling the command using a version 14: prefix.
Please see a reproducible example outlining the problem below. The first nbreg run works fine (in version 14); the second produces an error.
Thanks to Federico Tedeschi for reporting on this bug.
- joe
Code:
. . sysuse auto . . version 14: nbreg price mpg rep78 headroom, dispersion(constant) Fitting Poisson model: Iteration 0: log likelihood = -27501.177 Iteration 1: log likelihood = -27501.153 Iteration 2: log likelihood = -27501.153 Fitting constant-only model: Iteration 0: log likelihood = -18898.34 Iteration 1: log likelihood = -1055.8647 Iteration 2: log likelihood = -650.99018 Iteration 3: log likelihood = -633.56659 Iteration 4: log likelihood = -633.51076 Iteration 5: log likelihood = -633.51073 Fitting full model: Iteration 0: log likelihood = -633.51073 Iteration 1: log likelihood = -623.17825 Iteration 2: log likelihood = -621.78763 Iteration 3: log likelihood = -621.78255 Iteration 4: log likelihood = -621.78255 Negative binomial regression Number of obs = 69 LR chi2(3) = 23.46 Dispersion = constant Prob > chi2 = 0.0000 Log likelihood = -621.78255 Pseudo R2 = 0.0185 ------------------------------------------------------------------------------ price | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- mpg | -.0448621 .0090158 -4.98 0.000 -.0625327 -.0271915 rep78 | .0971834 .0431267 2.25 0.024 .0126566 .1817102 headroom | -.0508161 .0505203 -1.01 0.314 -.1498341 .048202 _cons | 9.475242 .3045943 31.11 0.000 8.878248 10.07224 -------------+---------------------------------------------------------------- /lndelta | 6.562892 .1723647 6.225063 6.90072 -------------+---------------------------------------------------------------- delta | 708.3171 122.0888 505.255 992.9898 ------------------------------------------------------------------------------ LR test of delta=0: chibar2(01) = 5.4e+04 Prob >= chibar2 = 0.000 . . r2c, devonly +----------------------------------------------------------------------+ |Deviance Adj. Dev. Model Cons. Only McFadden's | |R2 R2 Deviance Deviance R2 | |----------------------------------------------------------------------| |.2983 .2845 66.159256 94.277647 .0221 | |----------------------------------------------------------------------| |DP DP Model DP Cons. Only | |R2 Deviance Deviance | |----------------------------------------------------------------------| |.9934 520.63057 79,341.75 | +----------------------------------------------------------------------+ Note: The DP R2 can be compared with a Deviance R2 from a Poisson regression. . . version 15: nbreg price mpg rep78 headroom, dispersion(constant) Fitting Poisson model: Iteration 0: log likelihood = -27501.177 Iteration 1: log likelihood = -27501.153 Iteration 2: log likelihood = -27501.153 Fitting constant-only model: Iteration 0: log likelihood = -18898.34 Iteration 1: log likelihood = -1055.8647 Iteration 2: log likelihood = -650.99018 Iteration 3: log likelihood = -633.56659 Iteration 4: log likelihood = -633.51076 Iteration 5: log likelihood = -633.51073 Fitting full model: Iteration 0: log likelihood = -633.51073 Iteration 1: log likelihood = -623.17825 Iteration 2: log likelihood = -621.78763 Iteration 3: log likelihood = -621.78255 Iteration 4: log likelihood = -621.78255 Negative binomial regression Number of obs = 69 LR chi2(3) = 23.46 Dispersion = constant Prob > chi2 = 0.0000 Log likelihood = -621.78255 Pseudo R2 = 0.0185 ------------------------------------------------------------------------------ price | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- mpg | -.0448621 .0090158 -4.98 0.000 -.0625327 -.0271915 rep78 | .0971834 .0431267 2.25 0.024 .0126566 .1817102 headroom | -.0508161 .0505203 -1.01 0.314 -.1498341 .048202 _cons | 9.475242 .3045943 31.11 0.000 8.878248 10.07224 -------------+---------------------------------------------------------------- /lndelta | 6.562892 .1723647 6.225063 6.90072 -------------+---------------------------------------------------------------- delta | 708.3171 122.0888 505.255 992.9898 ------------------------------------------------------------------------------ LR test of delta=0: chibar2(01) = 5.4e+04 Prob >= chibar2 = 0.000 . . r2c, devonly equation lndelta not found equation lndelta not found r(111);
Comment