linear model with both within subject correlation and cross sectional

11 views
Skip to first unread message

ronen

unread,
May 18, 2015, 1:14:27 AM5/18/15
to israel-r-...@googlegroups.com
shalom,
I have data in the following way:
about 30 groups are followed for about 40 months.
Each month we observe Y_it (group i on time t)  which is unique to each group
and X_t which change only in time t but common to all groups.

The mixed linear model is:
Y_it = beta_i*X_t + u_i + gamma_i*v_t + e_it

where:
 beta_i  - is the fixed effect coefficient of X on group i
u_i    - is a random intercept of group i (could also change it to a fixed effect of group)
v_t  - is a random effect/noise of time t
gamma_i - is the specific effect of v_t on group i
We assume u_i,v_t and e_it are all normal and independent

Therefore covariance of y_it and y_jt (given X) is gamma_i*gamma_j*sigma(v_t)^2

How do I model such a depence in R (lme or lmer)?
I thought to use random effect for the u_i and repeated measures for the v_i ? 
But I am not sure how.

Thank you!
Ronen


 


   

amit gal

unread,
May 18, 2015, 3:28:15 AM5/18/15
to israel-r-...@googlegroups.com
Sounds like the kind of data I need for my PhD :-)

As a reference, I recommend Andrew Gelmans' book on hierarchical regression models - I found it highly instructive and clear (and he uses R, but recommends using bayesian approach to estimate such models. he does, however give examples of using lmer)

I haven't used that for a long time now, but I would guess you'd do something like this:

lmer( y~((1+v)|g+x*g)) where g is the grouping variable
maybe you need to split it into
lmer( y~ 1|g +v|g + x*g)

I hope I'm not completely off target here. so take this with a grain of salt

Amit


--
You received this message because you are subscribed to the Google Groups "Israel R User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to israel-r-user-g...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

ronen

unread,
May 18, 2015, 4:11:01 AM5/18/15
to israel-r-...@googlegroups.com
thank u Amit!
I dont have the book - but i will inquier about it

I was probably not clear enough!
I have one observation from each group on each time point (n~30*40)
so group is like a subject which is followed for T time points

The observed variables are: Y,X,group,time
v is a random noise on time t
perhapse you ment:  "time|g"
but this is not the case. this will give an identical covariance between any Y_it and Y_jt (givan X)

In my model the covariance should be specific for exh i and j (=gamma_i*gamma_j*var(v))
but similar on all time points.
It means group/subject i will usualy respond more/less strongly than group j
to the random noises on time t

Thats why random effect is not good here.
I should use repeated - but I am not sure how to specify the type of covariance.
   
Do you have an idea?

Thank you
Ronen
To unsubscribe from this group and stop receiving emails from it, send an email to israel-r-user-group+unsub...@googlegroups.com.

amit gal

unread,
May 18, 2015, 4:21:01 AM5/18/15
to israel-r-...@googlegroups.com

That was clear. :)

To unsubscribe from this group and stop receiving emails from it, send an email to israel-r-user-g...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Israel R User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to israel-r-user-g...@googlegroups.com.

amit gal

unread,
May 18, 2015, 4:22:46 AM5/18/15
to israel-r-...@googlegroups.com

I'm not sure if i understand this fully. But am driving so will look at it later

On May 18, 2015 11:11 AM, "ronen" <rfl...@gmail.com> wrote:
To unsubscribe from this group and stop receiving emails from it, send an email to israel-r-user-g...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Israel R User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to israel-r-user-g...@googlegroups.com.

Moran Koren

unread,
May 18, 2015, 4:45:11 AM5/18/15
to israel-r-...@googlegroups.com
Why not using panel data methods? such as vector auto-regressions and such?

ronen

unread,
May 18, 2015, 5:22:04 AM5/18/15
to israel-r-...@googlegroups.com
Thank u Moran,
I think random effects and repeated measures are panel data methods. no?
I assume there is no auto-correlation here (this could be tested later)
The main issue is the cross sectional dependence created by unmeasured common shocks
on time t.
I think there is no ready ready made procedure for this...

Ronen
To unsubscribe from this group and stop receiving emails from it, send an email to israel-r-user-group+unsub...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Israel R User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to israel-r-user-group+unsub...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Israel R User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to israel-r-user-group+unsub...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages