Hi all,

I have a question regarding  the use of the package contrast in conjunction
with a lme object. I am running a mixed effects ANCOVA:

model.1 <- lme(log(child_mortality) ~ as.factor(cluster) +
as.factor(cluster)*time +
  my.new.time + ttd +
  maternal_educ+ log(IHME_id_gdppc) + hiv_prev-1,
               merged0,na.action=na.omit,method="ML",weights=varPower(form
= ~ time),
               random= ~ time| country.x,
               correlation=corAR1(form = ~ time),
               control=lmeControl(msMaxIter = 200, msVerbose = TRUE))

I can use anova() over this model to get a sense of where the variation in
the data is coming from:

> anova(model.1)
                        numDF denDF   F-value p-value
as.factor(cluster)         10   170  270.3480  <.0001
time                        1  6417 1241.1048  <.0001
my.new.time                 1  6417    4.0275  0.0448
ttd                         1  6417    1.2398  0.2656
maternal_educ               1  6417   25.9095  <.0001
log(IHME_id_gdppc)          1  6417   20.1317  <.0001
hiv_prev                    1  6417   47.5296  <.0001
as.factor(cluster):time     9  6417    3.8326  0.0001

Here the factors are cluster and time*cluster and the other variables are
individual level predictors.
> levels(merged0$cluster)
 [1] "Democracy, High Income"          "Democracies, Middle Income"
 "Democracies, Low Income"
 [4] "Dictatorships, High Income"      "Dictatorships, Middle Income"
 "Dictarships, Low Income"
 [7] "One Transition, Middle Income"   "One transition, Low Income"
 "Many Transitions, Middle Income"
[10] "Many Transitions, Low Income"

Yet, I would like to run some contrast analysis, comparing differences
among factors. For example, are Low Income Democracies different from
Middle Income Democracies? I've try to set up the code for this but I
failed:

> contrast(model.1,list(group = "as.factor(cluster)Dictarships, Middle
Income:time"),list(group = "as.factor(cluster)Dictarships, Low
Income:time"))
Error in generateData(fit = list(modelStruct = list(reStruct =
list(country.x = c(0.618687033847368,  :
  factor(s) not in design: group
>

I've looked at the documentation and examples but so far without much
success: does anyone has any suggestion?


Thank you!

Antonio Pedro.

	[[alternative HTML version deleted]]

