[R-sig-ME] Two Questions re: Piecewise Mixed Effects Models

Albyn Jones jones at reed.edu
Sun Sep 30 19:40:50 CEST 2012


The first question has nothing to do with mixed effects per se.
your "time before" and "time after" are perfectly colinear.

  > Time Before: 2, 1, 0, -1, -2
  > TIme After: -2, -1, 0, 1, 2

The version with NA's will drop all observations except at time 0.

I think you want something like

  Time Before: -2, -1, 0, 0, 0
  TIme After:   0,  0, 0, 1, 2

albyn

On Sun, Sep 30, 2012 at 09:20:13AM +0000, Lofgren, Eric wrote:
> I'm relatively new to mixed effects models, and have two fairly basic questions (I think) about a project I'm working on.
> 
> Essentially, I'm working on a poisson regression problem where we're trying to estimate the impact of a change in a policy on the rate of an event X. There are N sites where this change has taken place, and we also happen to know another characteristic of each site Z. It's been suggested that I look a a piecewise mixed effects model (which I've also seen referred to as an interrupted time series or "broken stick" model).
> 
> I've got two questions about this type of model:
> 
> 1. As I understand it, you should have two time variables, a "Time Before" and a "Time After" variable, each of which equals 0 right at the point of the policy change. My question is what these variables should look like, specifically what they should look like after they reach zero. For example, with a simple series of 5 points and the policy change in the middle, should it look like this:
> 
> Time Before: 2, 1, 0, NA, NA
> Time After: NA, NA, 0, 1, 2
> 
> or this?
> 
> Time Before: 2, 1, 0, -1, -2
> TIme After: -2, -1, 0, 1, 2
> 
> Or something else entirely?
> 
> 2. In terms of using something like glmer() to fit the model itself, I'm a little confused about the syntax (I normally use SAS, but am trying to get better at using R). Following some advice I've seen, I should be using something like this:
> 
> model <- glmer( rate ~ policy + time.before + time.after + (1+ time.before + time.after + Z |Site) + offset(log(people)), data=data, family="poisson")
> 
> First, is this correct? Second, what's accomplished by having the time variables in both the fixed and random effects sections - what does that produce? A fixed slope and random intercept? Something else?
> 
> Thanks,
> 
> Eric
> _______________________________________________
> R-sig-mixed-models at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
> 

-- 
Albyn Jones
Reed College
jones at reed.edu



More information about the R-sig-mixed-models mailing list