Hi everyone, I am doing research on same sex couple at the moment and I am having some questions longitudinal model in R that I hope someone can help me with.
I want to examine if Partner A (IV) at time 1 predicts Partner A(DV) and Partner B(DV) at time 1,2,3,4,5. So I test "Time" as one predictor with value of 0,1,2,3,4; and then test interaction effect of "Time" and IV (DV ~ Time*IV). But I am not sure if this way is appropriate or it only tells me about the growth trajectories of DV and the effect of IV on this trajectory?
Thanks a lot for your help.
is your data sufficiently anonymised so that you could share it, or a portion with the forum?
Also would you share the code snippet relating to what you tried?
I can share a section of my data, but I do not know how to get a small dataset from my original data. Can you show me?
The code chunk i use is as below:
model <-lme(selfCSI~ time*SelfIS + time*PartnerIS ,
data = data2, random = ~time|CoupleID, na.action = "na.omit", method = "ML",control = lmeControl(opt = "optim"))
#>Linear mixed-effects model fit by maximum likelihood
Data: data2
AIC BIC logLik
-3211.466 -3160.716 1615.733
Random effects:
Formula: ~time | CoupleID
Structure: General positive-definite, Log-Cholesky parametrization
StdDev Corr
(Intercept) 3.55456615 (Intr)
time 2.09213669 -0.769
Residual 0.00122212
Fixed effects: selfCSI ~ time + SelfIS1 + PartnerIS1 + time * SelfIS1 + time * PartnerIS1
Value Std.Error DF t-value p-value
(Intercept) 16.539228 0.7995484 847 20.685714 0.0000
time 3.162756 0.5027901 847 6.290410 0.0000
SelfIS1 -0.091397 0.0333046 847 -2.744277 0.0062
PartnerIS1 -0.091397 0.0333046 847 -2.744277 0.0062
time:SelfIS1 -0.006323 0.0209046 847 -0.302467 0.7624
time:PartnerIS1 -0.006323 0.0209046 847 -0.302467 0.7624
Correlation:
(Intr) time SlfIS1 PrtIS1 t:SIS1
time -0.785
SelfIS1 -0.967 0.758
PartnerIS1 -0.967 0.758 1.000
time:SelfIS1 0.759 -0.967 -0.785 -0.785
time:PartnerIS1 0.759 -0.967 -0.785 -0.785 1.000
Standardized Within-Group Residuals:
Min Q1 Med Q3 Max
-0.0018831382 -0.0002364230 0.0000944857 0.0002675336 0.0016769274
Number of Observations: 1182
Number of Groups: 330