Hello,

I am so sorry, but I have been struggling with the code for the entire day.

I have a very simple dataset that looks like this:
response=c(45,47,24,35,47,56,29)
sub=c("A","A","B","B","C","C","C"гй
time=c(1,2,1,2,1,2,3)
gdata=cbind(response,sub,time)

Namely, for three subjects, each has 2 or 3 observations.
Assuming that each subject has a different variance, I want to test whether
the mean for the three subjects are equal.

I tried:
library(nlme)
weight <- varIdent(form = ~ 1 | sub )
lme1 <- lme(response~sub, weights = weight, data = gdata)

However, it shows error:
Error in getGroups.data.frame(dataMix, groups) :
  invalid formula for groups

Can anyone help me? Eventually want to try this:
lme1 <- lme(response~sub, weights = weight, data = gdata)
lme2 <- lme(response~1, weights = weight, data = gdata)
lrtest(lme1,lme2)

Am I on the right track? Or can anyone think of a better method?

Thank you very much!

Best regards,
Amanda

	[[alternative HTML version deleted]]

