I used gls and it still does not provide me different estimates of variance
for each treatment group. Did I do anything wrong?

lm3<-gls(GSI~treatment,data=z,weights=varIdent(form=~treatment),method="ML")
summary(lm3)
Generalized least squares fit by maximum likelihood
  Model: GSI ~ treatment 
  Data: z 
       AIC      BIC    logLik
  9.174574 12.71483 0.4127128


Coefficients:
                   Value Std.Error   t-value p-value
(Intercept)    1.0174923 0.1374462  7.402839  0.0000
treatmentHigh  0.7429293 0.1943783  3.822079  0.0028
treatmentLow  -0.0146910 0.1943783 -0.075579  0.9411
treatmentMid   0.3869267 0.2099526  1.842924  0.0924

 Correlation: 
              (Intr) trtmnH trtmnL
treatmentHigh -0.707              
treatmentLow  -0.707  0.500       
treatmentMid  -0.655  0.463  0.463

Standardized residuals:
       Min         Q1        Med         Q3        Max 
-1.9580366 -0.7219450 -0.1989222  0.9096203  1.8319336 

Residual standard error: 0.2354039 
Degrees of freedom: 15 total; 11 residual

Dieter Menne wrote:
> 
> 
> Feng, Jingyu wrote:
>> 
>> I'am trying to develop some code if R, which would correspond to what I
>> did in SAS.
>> The data look like:
>> 
>> Treatment    Replicate    group1      GSI
>> 
>> ..
>> The SAS code is:
>> proc mixed data=data_name order=data method=ml; *scoring=10;
>>       classes group1;
>>       model GSI=group1/residual influence solution;
>>       repeated /group=group1;
>> 
>> run;
>> 
>> Basically, I need different variance for each treatment group. I want to
>> do the similar thing in R.
>> 
>> Here is what I get so far:
>> lm1<-lme(response~treatment,data=o,random=~1|as.factor(dummy),weights=varIdent(form=~1|treatment),method="ML")
>> 
>> There should no random term in the model. However If I don't specify one,
>> lme won't work, so I made a dummy variable, which equals to 1 for every
>> observation.
>> 
>> 
> 
> The much underused (quote Frank Harrell) gls in package nlme should do
> that. Quote PB (p250): It can be viewed as an lme function without the
> random argument.
> 
> Dieter
> 

-- 
View this message in context: 
http://www.nabble.com/Fit-unequal-variance-model-in-R-tp22829549p22873062.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to