11
$\begingroup$

I have two years of data which looks basically like this:

Date ___ Violence Y/N? _ Number of patients

1/1/2008 ____ 0 __________ 11

2/1/2008 ____ 0 _________ 11

3/1/2008 _____1 __________ 12

4/1/2008 _____0 __________ 12

...

31/12/2009____ 0__________ 14

i.e. two years of observations, one per day, of a psychiatric ward, which indicate whether there was a violence incident on that day (1 is yes, 0 no) as well as the number of patients on the ward. The hypothesis that we wish to test is that more patients on the ward is associated with an increased probability of violence on the ward.

We realise, of course, that we will have to adjust for the fact that when there are more patients on the ward, violence is more likely because there are just more of them- we are interested in whether each individual’s probability of violence goes up when there are more patients on the ward.

I've seen several papers which just use logistic regression, but I think that is wrong because there is an autoregressive structure (although, looking at the autocorrelation function, it doesn’t get above .1 at any lag, although this is above the “significant” blue dashed line that R draws for me).

Just to make things more complicated, I can if I wish to break down the results into individual patients, so the data would look just as it does above, except I would have the data for each patient, 1/1/2008, 2/1/2008 etc. and an ID code going down the side so the data would show the whole history of incidents for each patient separately (although not all patients are present for all days, not sure whether that matters).

I would like to use lme4 in R to model the autoregressive structure within each patient, but some Googling comes up with the quotation “lme4 is not set up to deal with autoregressive structures”. Even if it were, I’m not sure I grasp how to write the code anyway.

Just in case anyone notices, I asked a question like this a while ago, they are different datasets with different problems, although actually solving this problem will help with that one (someone suggested I use mixed methods previously, but this autoregression thing has made me unsure how to do this).

So I’m a bit stuck and lost to be honest. Any help gratefully received!

$\endgroup$
  • $\begingroup$ I am dealing with a similar problem, I guess you can use pgmm from plm package but as your response variable is binary I don't know exactly how to do it. Maybe others can elaborate... (And yes you are right: my understanding is whenever you have an endogenous variable, in this case the lagged value, you can't use REML to estimate because it is biased, so you need to use GMM.) $\endgroup$ – teucer Oct 21 '10 at 13:08
2
$\begingroup$

Here is an idea that connects your binary dependent variable to a continuous, unobserved variable; a connection that may let you leverage the power of time series models for continuous variables.

Define:

$V_{w,t} = 1$ if violent incident happened in ward $w$ during time period $t$ and 0 otherwise

$P_{w,t}$ : Propensity for violence in ward $w$ at time $t$.

$P_{w,t}$ is assumed to be a continuous variable that in some sense represents 'pent-up' feelings of the inmates which boil over at some time and results in violence. Following this reasoning, we have:

$V_{w,t} = \begin{cases} 1 & \mbox{if } P_{w,t} \ge \tau \\ 0 & \mbox{otherwise} \end{cases}$

where,

$\tau$ is an unobserved threshold which triggers a violent act.

You can then use a time series model for $P_{w,t}$ and estimate the relevant parameters. For example, you could model $P_{w,t}$ as:

$P_{w,t} = \alpha_0 + \alpha_1 P_{w,t-1} + ... + \alpha_p P_{w,t-p}+ \beta n_{w,t} + \epsilon_t$

where,

$n_{w,t}$ is the number of patients in ward $w$ at time $t$.

You could see if $\beta$ is significantly different from 0 to test your hypothesis that "more patients lead to an increase in probability of violence".

The challenge of the above model specification is that you do not really observe $P_{w,t}$ and thus the above is not your usual time series model. I do not know anything about R so perhaps someone else will chip in if there is a package that would let you estimate models like the above.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.