[R-sig-ME] Repeated measures design in R

Manuel Spínola mspinola10 at gmail.com
Sun Feb 14 17:54:09 CET 2010


Dear list members,

Sorry for cross-posting.

I am analyzing a repeated measure design with the nlme package to assess 
the disease rate in 48 counties (localidad).  The disease rate was 
measured in 4 consecutive years.  The first 20 observations of my data 
set looks like:

 > ipa
             localidad tiempo    ipa
1             15.MILLAS      1 123.40
2             23.MILLAS      1 185.40
3             24.MILLAS      1  21.31
4             25.MILLAS      1   0.00
5             26.MILLAS      1  59.11
6             28.MILLAS      1  10.28
7              4.MILLAS      1 118.69
8              7.MILLAS      1  17.09
9              AGRODISA      1  59.49
10              ASELICA      1  50.98
11            BALTIMORE      1  25.10
12             BANANITA      1  19.30
13              BANASOL      1   0.00
14             BARBILLA      1  27.33
15                BATAN      1  48.58
16               B.LINE      1  57.97
17               BOSTON      1 101.32
18              BRISTOL      1  47.62
19  COLONIA.PURISCALEÑA      1  22.22
20               CORINA      1  22.22


I tried these models:


# Pooled data

modelo1 = glm(ipa ~ tiempo, family=gaussian(link=identity), data=ipa)
summary(modelo1)

# Parallel slopes

modelo2 = glm(ipa ~ tiempo + localidad, family=gaussian(link=identity), 
data=ipa)
summary(modelo2)

# Random intercept (el intercepto cambia para cada localidad)

modelo3 = lme(ipa ~ tiempo, random = ~ 1 | localidad, data=ipa)
summary(modelo3)

# Random intercept and slope

modelo4 = lme(ipa ~ tiempo, random =  ~ tiempo | localidad, data=ipa)
summary(modelo4)

# Autocorrelation

modelo6 = lme(ipa ~ tiempo, random =  ~ 1 | localidad, correlation = 
corCAR1(form = ~ tiempo | localidad), data=ipa)
summary(modelo6)


The model for Random intercept and slope gave me this error:

 > modelo4 = lme(ipa ~ tiempo, random =  ~ tiempo | localidad, data=ipa)
Error en lme.formula(ipa ~ tiempo, random = ~tiempo | localidad, data = 
ipa) :
 nlminb problem, convergence error code = 1
 message = iteration limit reached without convergence (9)

Do you know why the model (modelo4) has problems?

Also, is this the way to analyze a repeated measure design in R?

The counties (localidad) are all the county that I am interested, is 
that still random factor?

Thank you very much in advance.

Best,

Manuel Spínola

-- 
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