[R-sig-ME] Two Questions re: Piecewise mixed effects models

Joshua Wiley jwiley.psych at gmail.com
Mon Oct 1 18:36:49 CEST 2012


I think this is a replicate of another email thread on the list already.

On Sun, Sep 30, 2012 at 2:08 AM, Lofgren, Eric <elofgren at email.unc.edu> 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



-- 
Joshua Wiley
Ph.D. Student, Health Psychology
Programmer Analyst II, Statistical Consulting Group
University of California, Los Angeles
https://joshuawiley.com/



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