[R] strange result with contrasts
Arne.Muller@aventis.com
Arne.Muller at aventis.com
Tue Apr 20 15:44:41 CEST 2004
Hello,
I'm trying to reproduce some SAS result wit R (after I got suspicious with the result in R). I struggle with the contrasts in a linear model.
I've got three factors
> d$dose <- as.factor(d$dose) # 5 levels
> d$time <- as.factor(d$time) # 2 levels
> d$batch <- as.factor(d$batch) # 3 levels
the data frame d contains 82 rows. There are 2 to 4 replicates of each dose within each time point and each batch. There's one dose completely missing from one batch.
I then generate Dunnett contrasts using the multicomp library:
> contrasts(d$dose) <- contr.Dunnett(levels(d$dose), 1)
> contrasts(d$time) <- contr.Dunnett(levels(d$time), 1)
> contrasts(d$batch) <- contr.Dunnett(levels(d$batch), 1)
For the moment I'm just looking at the dose effects of the complete model:
> summary(lm(value ~ dose * time * batch, data = d))$coefficients[1:5,]
Estimate Std. Error t value Pr(>|t|)
(Intercept) 6.80211741 0.01505426 451.8399839 1.962247e-101
dose010mM-000mM -0.03454211 0.04113846 -0.8396549 4.046723e-01
dose025mM-000mM -0.01972550 0.04288981 -0.4599111 6.473607e-01
dose050mM-000mM -0.12015983 0.05356935 -2.2430704 2.886726e-02 <- significant
dose100mM-000mM 0.01252061 0.04113846 0.3043529 7.619872e-01
A collegue of mine has run the same data through a SAS program (listed below)
proc glm data = dftest;
class dose time batch;
model value = dose|time|batch;
means dose / dunnett ('000mM');
lsmeans dose /pdiff singular=1;
run;
Giving the following p-values:
Pr(>|t|)
dose010mM-000mM 0.4047
dose025mM-000mM 0.6474
dose050mM-000mM 0.5745 <---
dose100mM-000mM 0.7620
The p-values are the same expect for the one indicated.
A stripchart for the data in R shows that "dose050mM-000mM" should not be significant (it doesn't look different from e.g. "dose025mM-000mM").
Do you've any suggestions what I'm doing wrong here (assuming that I believe the SAS result)? Any hints what I can do to further analyse this problem?
Many thanks for your help,
+regards,
Arne
--
Arne Muller, Ph.D.
Toxicogenomics, Aventis Pharma
arne dot muller domain=aventis com
More information about the R-help
mailing list