I want to perform a linear mixed model with a fixed effect for time plus a random intercept & slope for time per subject. I do this with the following code:
lme.rik<-lmer(formula = AI ~ Time + (1+Time|ID), data=df6, control = lmerControl(check.nobs.vs.nRE = "ignore"))
I use the control = lmerControl(check.nobs.vs.nRE = "ignore" because there is probably something wrong with my Time variable. Nonetheless, the mode gives some output where it shows as fixed effects some sort of dummy variable for the number of weeks (i.e., time variable). So first the intercept, then Time[2], Time[..], Time[7]. Only excluding Time[1]. Same applies for the random effects. Is there a way to change the Time variable so that it will only include 1 fixed and 1 random estimate for estimate for Time?
The following output is my dataset:
structure(list(ID = c("ID1", "ID1", "ID1", "ID1", "ID1", "ID1",
"ID1", "ID10", "ID10", "ID10", "ID10", "ID10", "ID10", "ID10",
"ID11", "ID11", "ID11", "ID11", "ID11", "ID11", "ID11", "ID12",
"ID12", "ID12", "ID12", "ID12", "ID12", "ID12", "ID13", "ID13",
"ID13", "ID13", "ID13", "ID13", "ID13", "ID14", "ID14", "ID14",
"ID14", "ID14"), Time = c("1", "2", "3", "4", "5", "6", "7",
"1", "2", "3", "4", "5", "6", "7", "1", "2", "3", "4", "5", "6",
"7", "1", "2", "3", "4", "5", "6", "7", "1", "2", "3", "4", "5",
"6", "7", "1", "2", "3", "4", "5"), AI = c(0.393672183448241,
0.4876954603533, 0.411717908455957, 0.309769862660288, 0.149826889496538,
0.2448558592586, 0.123606753324621, 0.296109333767922, 0.309960002123076,
0.445886231347992, 0.370013553008003, 0.393414429902431, 0.318940511323733,
0.131112361225666, 0.31961673567578, 0.227268892979164, 0.433471105477564,
0.207184572401005, 0.144257239122978, NA, NA, 0.520204263001733,
0.194175420670027, 0.507417309543222, 0.1934679395598, 0.0831932654836405,
0.115391861884329, 0.141420940969022, 0.361215896677733, 0.256393554215028,
0.429431082438377, NA, NA, NA, NA, 0.239250372076152, 0.219099984707727,
NA, 0.289692898163938, 0.287732972580083), AI_VAR = c(0.154977788020905,
0.237846862049217, 0.169511636143347, 0.0959573678125739, 0.0224480968162077,
0.0599543918132674, 0.0152786294674538, 0.0876807375444826, 0.0960752029161373,
0.198814531305715, 0.136910029409606, 0.154774913655455, 0.101723049763444,
0.0171904512661696, 0.102154857724042, 0.0516511497159746, 0.187897199283942,
0.0429254470409874, 0.020810151039384, NA, NA, 0.270612475245176,
0.0377040939923819, 0.257472326024082, 0.0374298436375145, 0.00692111942183149,
0.0133152817891321, 0.0199998825445637, 0.130476924012699, 0.0657376546430145,
0.184411054564196, NA, NA, NA, NA, 0.0572407405385771, 0.0480048032989263,
NA, 0.0839219752466215, 0.0827902635097706), activity = c(0,
0.303472222222222, 0.232638888888889, 0.228472222222222, 0.348611111111111,
0.215972222222222, 0.123611111111111, 0.357638888888889, 0.235416666666667,
0.233333333333333, 0.2875, 0.353472222222222, 0.356944444444444,
0.149305555555556, 0.448611111111111, 0.213888888888889, 0.248611111111111,
0.288888888888889, 0.25625, NA, NA, 0.238888888888889, 0.263888888888889,
0.247916666666667, 0.315277777777778, 0.298611111111111, 0.173611111111111,
0.185416666666667, 0.45625, 0.239583333333333, 0.335416666666667,
NA, NA, NA, NA, 0.36875, 0.251388888888889, NA, 0.266666666666667,
0.309722222222222)), row.names = c(NA, -40L), class = c("tbl_df",
"tbl", "data.frame"))
Aucun commentaire:
Enregistrer un commentaire