Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.

# Re: st: xtmixed with nonrtolerance. What happens?

 From Anders Alexandersson To statalist@hsphsun2.harvard.edu Subject Re: st: xtmixed with nonrtolerance. What happens? Date Thu, 23 Jun 2011 09:31:22 -0400

```Lukas,
By simply using summarize, you can check if the scales differ, that
is, to see if any of your variables are very, very small or very, very
large.
The help for maximize states:
"nrtolerance(#) specifies the tolerance for the scaled gradient.
Convergence is declared
when g*inv(H)*g' < nrtolerance().  The default is nrtolerance(1e-5).
nonrtolerance specifies that the default nrtolerance() criterion
be turned off."

andersalex@gmail.com

On Jun 23, "Lukas Bösch" <L.Boesch@gmx.de> wrote:
> I transformed the data to z-scores (score-mean/stdeviation) before doing the regression.
> What do you mean with differing scales? I have either percents, for example % forest area,
> or absolute figures, for example land area, in my dataset, but they are all transformed and should therefore be uniform.
> What about nonrtolerance?
>
>
> -------- Original-Nachricht --------
>> Datum: Wed, 22 Jun 2011 18:48:22 -0400
>> Von: Stas Kolenikov <skolenik@gmail.com>
>> An: statalist@hsphsun2.harvard.edu
>> Betreff: Re: st: xtmixed with nonrtolerance. What happens?
>
>> It looks like you have data with wildly differing scales. I understand
>> that you need to interpret the results in the original scales, but
>> maybe you could rescale your variables so that all of your
>> coefficients would be about 1. Whether that will help convergence is
>> anybody's telling, of course, but usually differences in the scales
>> (and hence coefficients) of the order of 1e3-1e4 are detrimental to
>> numeric convergence.
>>
>> On Wed, Jun 22, 2011 at 4:33 PM, "Lukas Bösch" <L.Boesch@gmx.de> wrote:
>> > Dear Statalist community.
>> >
>> > I am using Stata 10.0 and doing a mixed model analysis of export data.
>> > After trying different options and always having trouble to get a
>> propper output i finally found a way to get to my results. I however could not
>> find any information about why it works and if it is allright. But let us
>> >
>> > 1) This is the command i enter and the output stata creates:
>> >
>> > xtmixed quantity year centforestarea2 centgdp2 centlandarea2
>> centpopulation2 || _all: R.country || _all: R.genus
>> >
>> > Performing EM optimization:
>> >
>> > Performing gradient-based optimization:
>> >
>> > Iteration 0:   log restricted-likelihood = -77051.164
>> > Iteration 1:   log restricted-likelihood = -77046.704
>> > Iteration 2:   log restricted-likelihood = -77046.565
>> > Iteration 3:   log restricted-likelihood =   -77046.5
>> > Iteration 4:   log restricted-likelihood = -77046.468  (backed up)
>> > Iteration 5:   log restricted-likelihood =  -77046.46  (backed up)
>> > Iteration 6:   log restricted-likelihood = -77046.456  (backed up)
>> > Iteration 7:   log restricted-likelihood = -77046.454  (backed up)
>> > numerical derivatives are approximate
>> > nearby values are missing
>> > Iteration 8:   log restricted-likelihood = -77046.453  (backed up)
>> > numerical derivatives are approximate
>> > nearby values are missing
>> > Hessian has become unstable or asymmetric
>> >
>> > Mixed-effects REML regression                   Number of obs
>>      =      6192
>> > Group variable: _all                            Number of
>> groups   =         1
>> >
>> >
>>  Obs per group: min =      6192
>> >
>>               avg =    6192.0
>> >
>>               max =      6192
>> >
>>  Wald chi2(5)       =      9.26
>> > Log restricted-likelihood = -77051.164          Prob > chi2
>>    =    0.0991
>> >    quantity |      Coef.   Std. Err.      z    P>|z|
>> [95% Conf. Interval]
>> >        year |  -429.7599   215.8898    -1.99   0.047
>>  -852.8961   -6.623654
>> > centfores~a2 |  -9875.264   6631.861    -1.49   0.136
>>  -22873.47    3122.945
>> >    centgdp2 |  -2024.629   4138.469    -0.49   0.625
>>  -10135.88    6086.621
>> > centlandar~2 |  -52889.76   63817.96    -0.83   0.407
>>  -177970.7    72191.13
>> > centpopul~n2 |   22296.98   10234.72     2.18   0.029
>> 2237.304    42356.66
>> >       _cons |   895402.2   433369.4     2.07   0.039
>> 46013.74     1744791
>> >
>> >  Random-effects Parameters  |   Estimate   Std. Err.     [95%
>> Conf. Interval]
>> >
>> > _all: Identity               |
>> >               sd(R.country) |   313329.2          .
>> > _all: Identity               |
>> >                 sd(R.genus) |   6757.304          .
>> >                sd(Residual) |   60169.26          .
>> > LR test vs. linear regression:       chi2(2) =  7810.42   Prob >
>> chi2 = 0.0000
>> >
>> > Note: LR test is conservative and provided only for reference.
>> > Warning: convergence not achieved; estimates are based on iterated EM
>> >
>> > Obviously Stata has a problem and can't calculate the standard errors of
>> the random factors.
>> >
>> > 2) With the option nonrtolerance it works however:
>> >
>> > xtmixed quantity year centforestarea2 centgdp2 centlandarea2
>> centpopulation2 || _all: R.country || _all: R.genus, nonrtolerance
>> >
>> > Performing EM optimization:
>> >
>> > Performing gradient-based optimization:
>> >
>> > Iteration 0:   log restricted-likelihood = -77051.164
>> > Iteration 1:   log restricted-likelihood = -77046.704
>> > Iteration 2:   log restricted-likelihood = -77046.565
>> > Iteration 3:   log restricted-likelihood =   -77046.5
>> > Iteration 4:   log restricted-likelihood = -77046.468  (backed up)
>> > Iteration 5:   log restricted-likelihood =  -77046.46  (backed up)
>> > Iteration 6:   log restricted-likelihood = -77046.456  (backed up)
>> >
>> > Computing standard errors:
>> >
>> > Mixed-effects REML regression                   Number of obs
>>      =      6192
>> > Group variable: _all                            Number of
>> groups   =         1
>> >
>> >
>>  Obs per group: min =      6192
>> >
>>               avg =    6192.0
>> >
>>               max =      6192
>> >
>> >
>> >
>>  Wald chi2(5)       =      9.22
>> > Log restricted-likelihood = -77046.456          Prob > chi2
>>    =    0.1008
>> >    quantity |      Coef.   Std. Err.      z    P>|z|
>> [95% Conf. Interval]
>> >        year |  -429.7645   216.4073    -1.99   0.047
>> -853.915   -5.614053
>> > centfores~a2 |  -9885.307    6647.52    -1.49   0.137
>>  -22914.21    3143.592
>> >    centgdp2 |  -2021.312   4148.464    -0.49   0.626
>>  -10152.15    6109.527
>> > centlandar~2 |  -52859.75   63778.66    -0.83   0.407
>>  -177863.6    72144.12
>> > centpopul~n2 |   22276.96   10257.46     2.17   0.030
>> 2172.715     42381.2
>> >       _cons |   895338.1   434389.3     2.06   0.039
>> 43950.68     1746726
>> >
>> >  Random-effects Parameters  |   Estimate   Std. Err.     [95%
>> Conf. Interval]
>> > _all: Identity               |
>> >               sd(R.country) |   313133.2    36075.6
>>  249840.9    392459.4
>> > _all: Identity               |
>> >                 sd(R.genus) |   3440.288   1355.694
>>  1589.157    7447.712
>> >                sd(Residual) |   60315.87   545.9681
>>  59255.23     61395.5
>> > LR test vs. linear regression:       chi2(2) =  7819.83   Prob >
>> chi2 = 0.0000
>> > Note: LR test is conservative and provided only for reference.
>> >
>> > Can someone explain to me why it works with nonrtolerance and tell me if
>> these outputs are as reliable as if they were created without
>> nonrtolerance. I searched in the stata help and on stata.com but could not find more