I tried this in a slightly different context and got no response, so I thought I'd try and frame the analysis slightly differently. The design is quite simple, but the analysis is proving difficult. Say I have 20 individual Subjects prone to mild anxiety attacks, half of which are assigned to a Control group and half to an Experimental group. I monitor these patients for 8 consecutive years, counting the number of anxiety attacks each year. After the initial 4 years, I provide members of the Control group a placebo and members of the Experimental group a supposed effective treatment. The hypothesis is that the supposed effective treatment has no effect in reality.

As I see it, I have several fixed effects, all of which are factors: Group (Control or Experiment); BA (Before "treatment" or After "treatment"); and Year (nested within BA). There is a single random effect: Subject (nested within Group).

Data can be simulated as follows (I have coded the attack rate Before slightly higher in the Experiment than the Control Group, with the attack rate increasing slightly after dosing in the Control group, but decreasing substantially in the Experiment group):
	Subject <- c(rep(c(1:20), 8))
	Group <- c(rep(c(rep("C", 10), rep("E", 10)), 8))
	BA <- c(rep("Bef", 80), rep("After", 80))
	Year <- c(rep(1990, 20), rep(1991, 20), rep(1992, 20), rep(1993, 20), rep(1994, 20), rep(1995, 20), rep(1996, 20), rep(1997, 20))
	Attack <- c(rep(c(rpois(10, lambda = 10), rpois(10, lambda = 12)), 4), rep(c(rpois(10, lambda = 12), rpois(10, lambda = 3)), 4))
	dat <- data.frame(Attack, Subject, Group, BA, Year)
	dat$Subject <- as.factor(dat$Subject)
	dat$Year <- as.factor(dat$Year)
The model seems like it should be:
	mod <- lmer(Attack ~ Group*BA + BA/Year + BA/Year:Group + Group/Subject:BA + (1|Group/Subject), data = dat, family = poisson)

BUT, this gives an error: "Error in mer_finalize(ans) : Downdated X'X is not positive definite, 1."

To avoid this error, I have to drop all of the interaction terms involving nesting. HOWEVER, if I code Year as a continuous covariate, I need only drop the term Group/Subject:BA. This suggests that interaction terms comprising only factors are not easily fit using this unreplicated design...

My questions are these:
1 - Does my initial model look correct (and do I need to specify the nesting - other threads suggest that this might not be necessary if nested variables have unique codes)?
2 - Why is it that the  factor-by-factor interactions won't work (I'm an lmer() novice, so it might be very obvious to some...)?
3 - Would I be more or less correct to simply ignore the Group/Subject:BA interaction and proceed with model development from there?

Any comments appreciated.

- Dave



_________
Dr Dave Schoeman
Lecturer in Marine Science
School of Environmental Sciences
University of Ulster
Cromore Road
Coleraine
BT52 1SA
Northern Ireland

Phone: +44 (0)28 701 24076
Mobile: +44 (0)75 49 526 743
Fax: +44 (0)28 701 24491

Treat data with care; under duress they will tell you anything you want to hear...


	[[alternative HTML version deleted]]


