Dear all, 

I fail to obtain meaningful contrasts using fit.contrast. This is what happens:


pf_contrasts_12_13 = rbind ( "ang vs. no" = c(1,-1,0), "ang vs. smooth" = c(1, 0, -1))
pf_contrasts_23 = rbind ( "no vs. smooth" = c(0, 1, -1))


fit.contrast (zav_reduced.lme, "prec", pf_contrasts_12_13, showall = F)
                    Estimate Std. Error  t-value   Pr(>|t|)
precang vs. no     0.2472222 0.09231578 2.678006 0.00752336
precang vs. smooth 0.1583333 0.09231578 1.715128 0.08662087
> fit.contrast (zav_reduced.lme, "prec", pf_contrasts_23, showall = F)
                     Estimate Std. Error    t-value  Pr(>|t|)
precno vs. smooth -0.08888889 0.09231578 -0.9628786 0.3358331
> fit.contrast (zav_reduced.lme, "fol", pf_contrasts_12_13, showall = F)
Error in `contrasts<-`(`*tmp*`, value = c(0.333333333333333, -0.666666666666667,  : 
  contrasts apply only to factors
> fit.contrast (zav_reduced.lme, "fol", pf_contrasts_23, showall = F)
Error in `contrasts<-`(`*tmp*`, value = c(0, 0.5, -0.5, -0.816496580927726,  : 
  contrasts apply only to factors
> 
> fit.contrast (zaob_reduced.lme, "prec", pf_contrasts_12_13, showall = F)
Error in `contrasts<-`(`*tmp*`, value = c(0.333333333333333, -0.666666666666667,  : 
  contrasts apply only to factors
> fit.contrast (zaob_reduced.lme, "prec", pf_contrasts_23, showall = F)
Error in `contrasts<-`(`*tmp*`, value = c(0, 0.5, -0.5, -0.816496580927726,  : 
  contrasts apply only to factors
> fit.contrast (zaob_reduced.lme, "fol", pf_contrasts_12_13, showall = F)
                    Estimate Std. Error   t-value    Pr(>|t|)
folang vs. no     -0.2138889  0.1033333 -2.069894 0.038709654
folang vs. smooth -0.3194444  0.1033333 -3.091400 0.002045380
> fit.contrast (zaob_reduced.lme, "fol", pf_contrasts_23, showall = F)
                   Estimate Std. Error   t-value  Pr(>|t|)
folno vs. smooth -0.1055556  0.1033333 -1.021506 0.3072532
> 
> fit.contrast (obik_reduced.lme, "prec", pf_contrasts_12_13, showall = F)
                     Estimate Std. Error   t-value   Pr(>|t|)
precang vs. no     -0.1888889  0.1129469 -1.672369 0.09475646
precang vs. smooth  0.1388889  0.1129469  1.229683 0.21909771
> fit.contrast (obik_reduced.lme, "prec", pf_contrasts_23, showall = F)
                   Estimate Std. Error  t-value   Pr(>|t|)
precno vs. smooth 0.3277778  0.1129469 2.902052 0.00378654
> fit.contrast (obik_reduced.lme, "fol", pf_contrasts_12_13, showall = F)
                   Estimate Std. Error  t-value     Pr(>|t|)
folang vs. no     0.4888889  0.1129469 4.328484 1.648352e-05
folang vs. smooth 0.5055556  0.1129469 4.476046 8.454479e-06
> fit.contrast (obik_reduced.lme, "fol", pf_contrasts_23, showall = F)
                   Estimate Std. Error   t-value  Pr(>|t|)
folno vs. smooth 0.01666667  0.1129469 0.1475620 0.8827175


The variables 'prec' and 'fol' are factors, and are from the same data set. How can it be that the system treats them as factors in some of the cases but generates a 'contrasts apply only to factors' message in others?

Help/ advice will be appreciated.

Best regards

Liliana Martinez


      _________________________________________________________


	[[alternative HTML version deleted]]


