[R-sig-ME] Dealing with heteroscedasticity in repeated measure models

Andrew Dolman andydolman at gmail.com
Sun Sep 26 14:51:22 CEST 2010


> I found an increase of variance when increasing time, is that a
> heteroscedasticity problem?

Yes, but it could be due to several things. For example, does your
dependent variable, ipa, increase with time? For many measurements the
variance increases with the mean so if the mean increases with time so
will the variance. To deal with this you would need to look at using
either a transformation, e.g. log, or using a generalized linear model
with an appropriate error distributions, e.g. poisson. It could also
be that you have divergent time series due to autocorrelation, in
which case your third model might be appropriate.

I'm having to guess because you haven't given enough information about
the data you are modeling. Ideally this would include a sample of the
data or dummy data that reproduces the problem.


> I fitted the model in the way you suggested me but I got an error (lack of
> convergence).  Is there any way to get around this problem?

This is fairly likely because you only have 4 data points per
localidad. You may have more luck using lmer from the lme4 package.


Andy.



>> modelo2 = lme(ipa ~ tempo, random = ~ tempo | localidad, data=ipa) #
>> intercepto y pendiente diferentes para cada localidad
> Error en lme.formula(ipa ~ tempo, random = ~tempo | localidad, data = ipa) :
>  nlminb problem, convergence error code = 1
>  message = iteration limit reached without convergence (9)
>
>
>
> On 26/09/2010 05:58 a.m., Andrew Dolman wrote:
>>
>> Hi Manuel,
>>
>> First of all a quick correction to your basic model specifications.
>>
>> First model is correct:
>> model1 = lme(ipa ~ tempo, data=ipa, random = ~1 | localidad) # random
>> intercept
>>
>> Second model is wrong
>> model2 = lme(ipa ~ tempo, random = ~1 | tempo/localidad, data=ipa) #
>> random intercept and slope
>>
>> should be
>> model2 = lme(ipa ~ tempo, random = ~tempo|localidad, data=ipa) #
>> random intercept and slope
>>
>> Your 3rd model fits an autoregressive model for temporally correlated
>> data. Whether this deals with heteroscedasticity depends on the type
>> of heteroscedasticity .
>>
>> model3 = lme(ipa ~ tempo, random = ~1 | localidad, data=ipa,
>> correlation=corAR1(form=~ tempo))
>>
>>
>>
>> andydolman at gmail.com
>>
>>
>>
>> On 26 September 2010 13:24, Manuel Spínola<mspinola10 at gmail.com>  wrote:
>>>
>>>  Dear list members,
>>>
>>> I am fitting a repeated measure model using lme.
>>> I have 4 measurements of a rate (variable called ipa) measured each year
>>> (variable called tempo, which was centered) on 48 counties (all the
>>> counties
>>> from a province, variable called localidad).
>>> I am considering county like a random factor.
>>> My models are:
>>>
>>> model1 = lme(ipa ~ tempo, data=ipa, random = ~1 | localidad) # random
>>> intercept
>>>
>>> model2 = lme(ipa ~ tempo, random = ~1 | tempo/localidad, data=ipa) #
>>> random
>>> intercept and slope
>>>
>>> model3 = lme(ipa ~ tempo, random = ~1 | localidad, data=ipa,
>>> correlation=corAR1(form=~ tempo))
>>>
>>> I have heteroscedasticity.
>>> Is my last model dealing with heteroscedasticity?
>>> Thank you very much in advance.
>>> Best,
>>>
>>> Manuel
>>>
>>> --
>>> Manuel Spínola, Ph.D.
>>> Instituto Internacional en Conservación y Manejo de Vida Silvestre
>>> Universidad Nacional
>>> Apartado 1350-3000
>>> Heredia
>>> COSTA RICA
>>> mspinola at una.ac.cr
>>> mspinola10 at gmail.com
>>> Teléfono: (506) 2277-3598
>>> Fax: (506) 2237-7036
>>>
>>> _______________________________________________
>>> R-sig-mixed-models at r-project.org mailing list
>>> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
>>>
>
>
> --
> Manuel Spínola, Ph.D.
> Instituto Internacional en Conservación y Manejo de Vida Silvestre
> Universidad Nacional
> Apartado 1350-3000
> Heredia
> COSTA RICA
> mspinola at una.ac.cr
> mspinola10 at gmail.com
> Teléfono: (506) 2277-3598
> Fax: (506) 2237-7036
>
>




More information about the R-sig-mixed-models mailing list