[R] Fitting heteroscedastic linear models/ problems with varIdent of nlme

Andreas Cordes andreas.cordes at stud.uni-goettingen.de
Thu Nov 3 18:43:33 CET 2005


Hi,
I would like to fit a model for a factorial design that allows for 
unequal variances in all groups. If I am not mistaken, this can be done 
in lm by specifying weights.
A function intended to specify weights for unequal variance structures 
is provided in the nlme library with the varIdent function. Is it 
apropriate to use these weights with lm? If not, is there another 
possibility to do factorial designs with heteroscedasticity?

When trying to use varIdent I get an errormessage that says that 
varIndent is not a defined class. The function calls are written in the 
same way as in Pinheiro & Bates Book. Their example works. With my data 
it doesnt. I somehow fail to figure out the difference between them.
In the remainder is a subset of my Dataset in which the problem also 
occours. A,B,C are metric variables, D is a factor.

I wold be thankful if any Ideas you might have.

thank you for your attention
Andreas

 > dat2
        A  B  C D
1   990.5 20 46 1
2   990.5 20 44 1
3   704.5 19 35 1
4   990.5 20 39 1
5  2240.5 25 79 2
6  2240.5 25 43 2
7  2240.5 25 44 2
8  2240.5 25 50 2
9  2240.5 25 56 2
10  470.0 17 51 2

 > vi<-varIdent(form=~1|D)
 > vi<-initialize(vi,dat2)
Error in getClass(Class) : c("\"varIdent\" is not a defined class", 
"\"varFunc\" is not a defined class")
In addition: Warning message:
the condition has length > 1 and only the first element will be used in: 
if (!is.na(match(Class, .BasicClasses))) return(newBasic(Class, 
 >




More information about the R-help mailing list