[R] gls with "crossed heteroscedasticity"

Ramon Diaz rdiaz at cnio.es
Fri Mar 14 11:05:41 CET 2003


Dear All,

I am using the function gls (in the nlme package) and I would like to fit a 
heteroscedastic model, with different variances for each of the levels of two 
stratification variables.

In p. 210 of Pinheiro & Bates ("Mixed effects models in S and S-Plus", 2000, 
Springer), the authors show the use of the "*" operator. However, that is not 
what I want, because it fits a different variance parameter to each 
combination of the two levels. What I would like is more along the ways of p. 
163 and ff., where they fit models with crossed random effects.

I think this can be achieved using varComb. If we have two strata, say ID1 and 
ID2, we can do:

gls(my.formula, 
    weights = varComb( varIdent(form = ~ 1 | ID), varIdent(form = ~ 1 | ID2)))

This seems to work (and to produce reasonable results) but I am not sure if it 
is right, or I am doing something dumb. 

Best,


-- 
Ramón Díaz-Uriarte
Bioinformatics Unit
Centro Nacional de Investigaciones Oncológicas (CNIO)
(Spanish National Cancer Center)
Melchor Fernández Almagro, 3
28029 Madrid (Spain)
http://bioinfo.cnio.es/~rdiaz



More information about the R-help mailing list