[R] R - lme

Divaker divaker at gmail.com
Mon Nov 12 03:53:31 CET 2007


Dear R gurus,

I am trying to work out the problem given in Nested design - Montgomery - Design of Experiments p.561 
I have attached a pdf of the data as well the anova table. It is a mixed model with Supplier as fixed effect and batches within the supplier as random effects.
I am able to work out the error stratums as below using aov. Which agrees perfectly with the book example

process=read.table("purity.csv", sep=",", header=TRUE)
proc1=aov(Purity~Supplier+Error(Supplier/Batch), process)

#Results in 
print(summary(proc1))
#Error: Supplier -corresponds to fixed effect of Supplier
#         Df  Sum Sq Mean Sq
#Supplier  2 15.0556  7.5278

#Error: Supplier:Batch -corresponds to random effect of Batch in Supplier
#          Df Sum Sq Mean Sq F value Pr(>F)
#Residuals  9 69.917   7.769               

#Error: Within --corresponds to error within replications
#          Df Sum Sq Mean Sq F value Pr(>F)
#Residuals 24 63.333   2.639              

But am not able to get results from the lme model as below. (The model also seems to be wrong with lot of NaNs produced)
How do I frame the model such that I can get only  ~1 | Batch %in% Supplier
Or something else is wrong
Please tell me where I have gone wrong
 

library(nlme)
proclme=lme(Purity~Supplier,random = ~1|Supplier/Batch,process)
summary(proclme)
VarCorr(proclme)

Linear mixed-effects model fit by REML
 Data: process 
       AIC     BIC    logLik
  154.8440 163.823 -71.42198

Random effects:
 Formula: ~1 | Supplier
        (Intercept)
StdDev:    1.250514

 Formula: ~1 | Batch %in% Supplier
        (Intercept) Residual
StdDev:    1.307622 1.624466

Fixed effects: Purity ~ Supplier 
                 Value Std.Error DF    t-value p-value
(Intercept) -0.4166667  1.486998 24 -0.2802067  0.7817
SupplierB2   0.7500000  2.102932  0  0.3566449     NaN
SupplierB3   1.5833333  2.102932  0  0.7529169     NaN
 Correlation: 
           (Intr) SpplB2
SupplierB2 -0.707       
SupplierB3 -0.707  0.500

Standardized Within-Group Residuals:
        Min          Q1         Med          Q3         Max 
-1.47513431 -0.75010146  0.08125895  0.70609383  1.87201306 

Number of Observations: 36
Number of Groups: 
           Supplier Batch %in% Supplier 
                  3                  12 
Warning message:
In pt(q, df, lower.tail, log.p) : NaNs produced
> VarCorr(proclme)
            Variance     StdDev  
Supplier =  pdLogChol(1)         
(Intercept) 1.563785     1.250514
Batch =     pdLogChol(1)         
(Intercept) 1.709877     1.307622
Residual    2.638889     1.624466
> intervals(proclme)
Error in intervals.lme(proclme) : 
  Cannot get confidence intervals on var-cov components: Non-positive definite approximate variance-covariance
In addition: Warning message:
In qt(p, df, lower.tail, log.p) : NaNs produced


Divaker

Dr. C. Divaker Durairaj, ME, Ph.D
Professor, Farm Machinery
Agricultural Machinery Research Centre
Tamil Nadu Agricultural University
Coimbatore 641003, India
Ph: 91-422-6611204

-------------- next part --------------
A non-text attachment was scrubbed...
Name: montgomry.pdf
Type: application/pdf
Size: 160034 bytes
Desc: not available
Url : https://stat.ethz.ch/pipermail/r-help/attachments/20071112/ed685b4c/attachment.pdf 


More information about the R-help mailing list