stats/stackexchange novice here i'm afraid. I've got a data set which I believe a multilevel linear model will suit nicely but i'm struggling with a) whether this is the right technique and b) how to approach formulating the model in R.
The data consist of: Id of individual, for each individual there's 2 time points ('Period': day vs night), x and y variables (which are linearly related) and a group (1 vs 0).
I want to test whether the relationship between x and y is different during the day vs night, and whether the group has any effect on the day-night changes (interaction?).
Here's what i've tried so far (ignoring group for now):
a<-lme(y~x*Period, data=d, random= ~x|Individual, method="REML")
How far off is this? Am I right in thinking that x and Individual are random effects with x nested in Individual? or have I misunderstood this?
Apologies for the messy post - hopefully enough information is here!
Any help appreciated. Thanks!