Я пытался смоделировать непрерывную переменную ( Y ) как функцию времени в секундах ( Время ), учитывая внутри субъекта ( ID ) корреляция с использованием функции lmer()
пакета lme4. Я заметил, что если я использую полный набор данных (более 100 временных точек), модель не может сходиться, и я получаю следующее сообщение об ошибке:
Error in eval_f(x, ...) : Downdated VtV is not positive definite. In addition: Warning message:
Some predictor variables are on very different scales: consider rescaling
Я не понимаю, как это может быть, учитывая, что единственным предиктором в модели является время. Чтобы увидеть, связана ли проблема с количеством временных точек, я создал усеченный фрейм данных, в котором время для каждого субъекта идет только от 0-50 секунд, и заметил, что модель будет сходиться до 50 временных точек:
> body_rs <- lmer(Y ~ 1 + Time + (1 + Time | ID), data = truncatedph)
> summary(body_rs)
Linear mixed model fit by REML ['lmerMod']
Formula: Y ~ 1 + Time + (1 + Time | ID)
Data: truncatedph
REML criterion at convergence: -806.5
Scaled residuals:
Min 1Q Median 3Q Max
-5.9843 -0.1106 0.0119 0.2692 3.9455
Random effects:
Groups Name Variance Std.Dev. Corr
ID (Intercept) 9.679e-03 0.098383
Time 6.237e-06 0.002497 -0.77
Residual 5.168e-03 0.071890
Number of obs: 357, groups: ID, 7
Fixed effects:
Estimate Std. Error t value
(Intercept) 6.6780198 0.0379340 176.04
Time -0.0009101 0.0009787 -0.93
Correlation of Fixed Effects:
(Intr)
Time -0.773
Вот структура данных с 51 моментом времени (не сходится):
> dput(truncatedph)
structure(list(Time = c(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,
12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27,
28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43,
44, 45, 46, 47, 48, 49, 50, 51, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25,
26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41,
42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 0, 1, 2, 3, 4, 5, 6,
7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38,
39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 0, 1, 2,
3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51,
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33,
34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49,
50, 51, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
48, 49, 50, 51, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45,
46, 47, 48, 49, 50, 51), Y = c(6.85, 6.78, 6.68, 6.8, 6.74, 6.63,
6.7, 6.72, 6.75, 6.8, 6.62, 6.8, 6.7, 6.72, 6.7, 6.89, 6.72,
6.57, 6.7, 6.68, 6.7, 6.7, 6.7, 6.7, 6.7, 6.68, 6.7, 6.7, 6.7,
6.72, 6.7, 6.7, 6.65, 6.68, 6.7, 6.7, 6.67, 6.68, 6.7, 6.7, 6.7,
6.68, 6.68, 6.72, 6.7, 6.7, 6.7, 6.68, 6.65, 6.68, 6.72, 6.7,
6.67, 6.67, 6.67, 6.67, 6.67, 6.67, 6.67, 6.67, 6.67, 6.67, 6.67,
6.67, 6.67, 6.67, 6.67, 6.67, 6.67, 6.67, 6.67, 6.67, 6.67, 6.67,
6.67, 6.67, 6.67, 6.67, 6.67, 6.67, 6.67, 6.67, 6.67, 6.67, 6.67,
6.67, 6.67, 6.67, 6.67, 6.67, 6.67, 6.67, 6.67, 6.67, 6.67, 6.67,
6.67, 6.67, 6.67, 6.67, 6.67, 6.67, 6.67, 6.67, 6.66, 6.6, 6.6,
6.56, 6.58, 6.6, 6.6, 6.6, 6.6, 6.58, 6.61, 6.61, 6.6, 6.61,
6.6, 6.61, 6.61, 6.6, 6.6, 6.61, 6.6, 6.6, 6.6, 6.6, 6.6, 6.6,
6.6, 6.61, 6.6, 6.6, 6.6, 6.6, 6.6, 6.6, 6.6, 6.6, 6.6, 6.6,
6.61, 6.61, 6.6, 6.6, 6.6, 6.61, 6.6, 6.6, 6.61, 6.61, 6.6, 6.6,
6.6, 6.61, 6.63, 6.79, 6.84, 6.79, 6.33, 6.47, 6.66, 6.79, 6.86,
6.77, 6.79, 6.81, 6.88, 6.88, 6.77, 6.64, 6.7, 6.71, 6.7, 6.77,
6.75, 6.75, 6.77, 6.7, 6.81, 6.77, 6.77, 6.78, 6.78, 6.75, 6.73,
6.75, 6.75, 6.78, 6.77, 6.77, 6.75, 6.77, 6.75, 6.73, 6.77, 6.73,
6.75, 6.77, 6.77, 6.73, 6.77, 6.77, 6.75, 6.77, 6.75, 6.77, 6.63,
6.67, 6.61, 6.65, 6.72, 6.63, 6.62, 6.62, 6.63, 6.62, 6.59, 6.65,
6.62, 6.62, 6.62, 6.63, 6.57, 6.62, 6.62, 6.62, 6.62, 6.62, 6.62,
6.62, 6.62, 6.62, 6.63, 6.63, 6.61, 6.59, 6.63, 6.55, 6.53, 6.47,
6.57, 6.3, 6.72, 6.62, 6.61, 6.23, 6.61, 6.4, 6.69, 6.13, 6.23,
6.84, 6.76, 6.72, 6.63, 6.55, 6.72, 6.55, 6.9, 6.91, 6.84, 6.86,
6.84, 6.81, 6.79, 6.81, 6.51, 6.7, 6.81, 6.86, 6.88, 6.86, 6.86,
6.81, 6.75, 6.77, 6.64, 6.66, 6.66, 6.6, 6.66, 6.63, 6.63, 6.66,
6.66, 6.66, 6.62, 6.62, 6.64, 6.62, 6.62, 6.68, 6.68, 6.71, 6.57,
6.62, 6.68, 6.73, 6.71, 6.68, 6.68, 6.66, 6.64, 6.64, 6.62, 6.3,
6.7, 6.53, 6.27, 6.4, 6.32, 6.45, 6.51, 6.53, 6.55, 6.56, 6.56,
6.56, 6.58, 6.56, 6.58, 6.58, 6.58, 6.58, 6.58, 6.58, 6.6, 6.56,
6.58, 6.58, 6.58, 6.58, 6.6, 6.6, 6.6, 6.6, 6.58, 6.62, 6.56,
6.58, 6.6, 6.6, 6.6, 6.58, 6.6, 6.6, 6.6, 6.6, 6.6, 6.58, 6.58,
6.6, 6.6, 6.6, 6.6, 6.6, 6.61, 6.6, 6.6, 6.6, 6.6, 6.6), ID = c("Patient1",
"Patient1", "Patient1", "Patient1", "Patient1", "Patient1", "Patient1",
"Patient1", "Patient1", "Patient1", "Patient1", "Patient1", "Patient1",
"Patient1", "Patient1", "Patient1", "Patient1", "Patient1", "Patient1",
"Patient1", "Patient1", "Patient1", "Patient1", "Patient1", "Patient1",
"Patient1", "Patient1", "Patient1", "Patient1", "Patient1", "Patient1",
"Patient1", "Patient1", "Patient1", "Patient1", "Patient1", "Patient1",
"Patient1", "Patient1", "Patient1", "Patient1", "Patient1", "Patient1",
"Patient1", "Patient1", "Patient1", "Patient1", "Patient1", "Patient1",
"Patient1", "Patient1", "Patient1", "Patient2", "Patient2", "Patient2",
"Patient2", "Patient2", "Patient2", "Patient2", "Patient2", "Patient2",
"Patient2", "Patient2", "Patient2", "Patient2", "Patient2", "Patient2",
"Patient2", "Patient2", "Patient2", "Patient2", "Patient2", "Patient2",
"Patient2", "Patient2", "Patient2", "Patient2", "Patient2", "Patient2",
"Patient2", "Patient2", "Patient2", "Patient2", "Patient2", "Patient2",
"Patient2", "Patient2", "Patient2", "Patient2", "Patient2", "Patient2",
"Patient2", "Patient2", "Patient2", "Patient2", "Patient2", "Patient2",
"Patient2", "Patient2", "Patient2", "Patient2", "Patient2", "Patient2",
"Patient2", "Patient3", "Patient3", "Patient3", "Patient3", "Patient3",
"Patient3", "Patient3", "Patient3", "Patient3", "Patient3", "Patient3",
"Patient3", "Patient3", "Patient3", "Patient3", "Patient3", "Patient3",
"Patient3", "Patient3", "Patient3", "Patient3", "Patient3", "Patient3",
"Patient3", "Patient3", "Patient3", "Patient3", "Patient3", "Patient3",
"Patient3", "Patient3", "Patient3", "Patient3", "Patient3", "Patient3",
"Patient3", "Patient3", "Patient3", "Patient3", "Patient3", "Patient3",
"Patient3", "Patient3", "Patient3", "Patient3", "Patient3", "Patient3",
"Patient3", "Patient3", "Patient3", "Patient3", "Patient3", "Patient4",
"Patient4", "Patient4", "Patient4", "Patient4", "Patient4", "Patient4",
"Patient4", "Patient4", "Patient4", "Patient4", "Patient4", "Patient4",
"Patient4", "Patient4", "Patient4", "Patient4", "Patient4", "Patient4",
"Patient4", "Patient4", "Patient4", "Patient4", "Patient4", "Patient4",
"Patient4", "Patient4", "Patient4", "Patient4", "Patient4", "Patient4",
"Patient4", "Patient4", "Patient4", "Patient4", "Patient4", "Patient4",
"Patient4", "Patient4", "Patient4", "Patient4", "Patient4", "Patient4",
"Patient4", "Patient4", "Patient4", "Patient4", "Patient4", "Patient4",
"Patient4", "Patient4", "Patient4", "Patient5", "Patient5", "Patient5",
"Patient5", "Patient5", "Patient5", "Patient5", "Patient5", "Patient5",
"Patient5", "Patient5", "Patient5", "Patient5", "Patient5", "Patient5",
"Patient5", "Patient5", "Patient5", "Patient5", "Patient5", "Patient5",
"Patient5", "Patient5", "Patient5", "Patient5", "Patient5", "Patient5",
"Patient5", "Patient5", "Patient5", "Patient5", "Patient5", "Patient5",
"Patient5", "Patient5", "Patient5", "Patient5", "Patient5", "Patient5",
"Patient5", "Patient5", "Patient5", "Patient5", "Patient5", "Patient5",
"Patient5", "Patient5", "Patient5", "Patient5", "Patient5", "Patient5",
"Patient5", "Patient6", "Patient6", "Patient6", "Patient6", "Patient6",
"Patient6", "Patient6", "Patient6", "Patient6", "Patient6", "Patient6",
"Patient6", "Patient6", "Patient6", "Patient6", "Patient6", "Patient6",
"Patient6", "Patient6", "Patient6", "Patient6", "Patient6", "Patient6",
"Patient6", "Patient6", "Patient6", "Patient6", "Patient6", "Patient6",
"Patient6", "Patient6", "Patient6", "Patient6", "Patient6", "Patient6",
"Patient6", "Patient6", "Patient6", "Patient6", "Patient6", "Patient6",
"Patient6", "Patient6", "Patient6", "Patient6", "Patient6", "Patient6",
"Patient6", "Patient6", "Patient6", "Patient6", "Patient6", "Patient7",
"Patient7", "Patient7", "Patient7", "Patient7", "Patient7", "Patient7",
"Patient7", "Patient7", "Patient7", "Patient7", "Patient7", "Patient7",
"Patient7", "Patient7", "Patient7", "Patient7", "Patient7", "Patient7",
"Patient7", "Patient7", "Patient7", "Patient7", "Patient7", "Patient7",
"Patient7", "Patient7", "Patient7", "Patient7", "Patient7", "Patient7",
"Patient7", "Patient7", "Patient7", "Patient7", "Patient7", "Patient7",
"Patient7", "Patient7", "Patient7", "Patient7", "Patient7", "Patient7",
"Patient7", "Patient7", "Patient7", "Patient7", "Patient7", "Patient7",
"Patient7", "Patient7", "Patient7")), class = c("grouped_df",
"tbl_df", "tbl", "data.frame"), row.names = c(NA, -364L), groups = structure(list(
ID = c("Patient1", "Patient2", "Patient3", "Patient4", "Patient5",
"Patient6", "Patient7"), .rows = list(1:52, 53:104, 105:156,
157:208, 209:260, 261:312, 313:364)), row.names = c(NA,
-7L), class = c("tbl_df", "tbl", "data.frame"), .drop = TRUE))
Я искал решение этой проблемы, но другие люди, которые столкнулись с той же ошибкой кажется, имеют более сложные модели (больше предикторов). Я был бы признателен за любую помощь в понимании того, что я делаю здесь неправильно, и я более чем открыт для альтернативных предложений.
Спасибо.