Dear All,

I have two factors: GROUP and PATIENT, where PATIENT is nested within  
GROUP.

 >levels(example$GROUP)
[1] "0" "1" "2" "3" "4"

 > levels(example$PATIENT)
[1] "1" "2" "3"

There are three observations at each combination of these factors.   
However, there are no observations for PATIENT = 3 and GROUP = 4.

 > table(example$GROUP, example$PATIENT)

     1 2 3
   0 3 3 3
   1 3 3 3
   2 3 3 3
   3 3 3 3
   4 3 3 0

  When I run an ANOVA on these factors

 > fit <- lm(ABUNDANCE ~ GROUP + GROUP/PATIENT, data = example)

I receive an NA in the parameter estimate corresponding to missing  
combination.

 > summary(fit)

Call:
lm(formula = ABUNDANCE ~ GROUP + GROUP/PATIENT, data = example)

Residuals:
     Min      1Q  Median      3Q     Max
-1.2985 -0.4284  0.1998  0.3663  0.8585

Coefficients: (1 not defined because of singularities)
                 Estimate Std. Error t value Pr(>|t|)
(Intercept)     13.18320    0.37333  35.312   <2e-16 ***
GROUP1           0.61861    0.52797   1.172    0.251
GROUP2           0.18993    0.52797   0.360    0.722
GROUP3           0.27163    0.52797   0.514    0.611
GROUP4          -0.28173    0.52797  -0.534    0.598
GROUP0:PATIENT2  0.12643    0.52797   0.239    0.812
GROUP1:PATIENT2 -0.72617    0.52797  -1.375    0.180
GROUP2:PATIENT2 -0.26360    0.52797  -0.499    0.621
GROUP3:PATIENT2  0.04293    0.52797   0.081    0.936
GROUP4:PATIENT2  0.59812    0.52797   1.133    0.267
GROUP0:PATIENT3  0.28147    0.52797   0.533    0.598
GROUP1:PATIENT3 -0.36452    0.52797  -0.690    0.496
GROUP2:PATIENT3 -0.34737    0.52797  -0.658    0.516
GROUP3:PATIENT3 -0.55119    0.52797  -1.044    0.305
GROUP4:PATIENT3       NA         NA      NA       NA
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 0.6466 on 28 degrees of freedom
Multiple R-squared: 0.1867,	Adjusted R-squared: -0.191
F-statistic: 0.4943 on 13 and 28 DF,  p-value: 0.9093


I need to perform a contrast on various levels of GROUP/PATIENT, and  
the NA prevents me from doing so.  Is there a way to manipulate the  
levels of the factors so that an NA is not present in the parameter  
estimates?

Thanks,
Tim



	[[alternative HTML version deleted]]


