[R] contrasts in lm and lme
Peter Dalgaard BSA
p.dalgaard at biostat.ku.dk
Fri Jun 15 21:27:11 CEST 2001
"Peter B. Mandeville" <mandevip at deimos.tc.uaslp.mx> writes:
> SAS treatment helmert sum sdif
> Pr(>F) 3.073e-05 3.073e-05 3.073e-05 3.073e-05 3.073e-05
>
> the probabilities of the different contrasts were
>
> SAS treatment helmert sum sdif
> A-B 0.072635 0.072635 0.072635
> A-C 8.69e-06 8.69e-06 0.000322
> B-C 0.00875 0.637971 0.00875
>
> Why does the contrast contr.sum have distinct results from the other
> contrasts? Which ones are confiable?
Are you reading the output correctly? Sum contrasts are the ones that
sum to zero, so you get k-1 values and the k-th one is minus the sum
of the others. One result of this is that the test of each individual
coefficient is meaningless (whether a group level is equal to the
average of all group levels).
If the process is repeated with lme in place of lm with
> res <- lm(dbp~Treatment+Visit+dbp1,random=~1|Patient)
in place of
> res <- lm(dbp~Treatment+Visit+dbp1)
...
> SAS treatment helmert sum sdif
> AIC 7501.212 7501.212 7511.151 7506.182 7501.212
> BIC 7546.116 7546.116 7556.055 7551.086 7546.116
> logLik -3741.606 -3741.606 -3746.576 -3744.091 -3741.606
>
> Given that AIC and BIC are calculated logLik, it is reasonable that they
> differ given the different values of the logLik, but is it reasonable that
> the logLik's are different?
I think the model is contrast independent when specified like that.
(But you have a typo in the command, so that's not what you ran...)
Looks like there might a convergence problem with the sum and helmert
contrasts, although they are the ones normally considered numerically
more stable. Do the variance estimates look similar?
> SAS treatment helmert sum sdif
> A-B 0.2330 0.2330 0.2330
> A-C 0.0033 0.0033 0.0168
> B-C 0.0850 0.7553 0.0850
>
> Again, why does the contrast contr.sum have distinct results from the other
> contrasts? Which ones are confiable?
Same as before I think.
--
O__ ---- Peter Dalgaard Blegdamsvej 3
c/ /'_ --- Dept. of Biostatistics 2200 Cph. N
(*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
More information about the R-help
mailing list