我有一个嵌套的数据集,指定实验者(experimenter_1_2
,2个值)内的细胞(no
,240个值),以及三种不同治疗的治疗状态(cis_0_1
,2个值;rt_0_1
,取2个值;dex_dose_0_1_10_30_50_70_90_110_ug_ml
,8个值)。
我正尝试用线性混合模型拟合数据:
lme4::lmer(cell_tox ~ cis_0_1 * rt_0_1 * dex_dose_0_1_10_30_50_70_90_110_ug_ml + # fixed effects: 32 treatment combinations
+ (1 | experimenter_1_2 / no), # random effects: 2 experimenters
data = df)
但我得到这个错误:
Error: number of levels of each grouping factor must be < number
of observations (problems: no:experimenter_1_2)
我认为,对于随机效应,不可能只有一个观察值的组(如果我的理解正确,请告诉我),所以我从分组因子中删除了no
:
lme4::lmer(cell_tox ~ cis_0_1 * rt_0_1 * dex_dose_0_1_10_30_50_70_90_110_ug_ml + # fixed effects: 32 treatment combinations
+ (1 | experimenter_1_2), # random effects: 2 experimenters
data = df)
但现在我收到了这个警告,我不确定它是否可以忽略:
boundary (singular) fit: see ?isSingular
我认为原因可能是配方中的三向交互作用,但细胞 * 暴露于 * 三种处理的不同类别。那么,我应该如何处理这个警告呢?
数据:
structure(list(no = structure(1:240, .Label = c("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", "52", "53", "54", "55", "56", "57", "58", "59",
"60", "61", "62", "63", "64", "65", "66", "67", "68", "69", "70",
"71", "72", "73", "74", "75", "76", "77", "78", "79", "80", "81",
"82", "83", "84", "85", "86", "87", "88", "89", "90", "91", "92",
"93", "94", "95", "96", "97", "98", "99", "100", "101", "102",
"103", "104", "105", "106", "107", "108", "109", "110", "111",
"112", "113", "114", "115", "116", "117", "118", "119", "120",
"121", "122", "123", "124", "125", "126", "127", "128", "129",
"130", "131", "132", "133", "134", "135", "136", "137", "138",
"139", "140", "141", "142", "143", "144", "145", "146", "147",
"148", "149", "150", "151", "152", "153", "154", "155", "156",
"157", "158", "159", "160", "161", "162", "163", "164", "165",
"166", "167", "168", "169", "170", "171", "172", "173", "174",
"175", "176", "177", "178", "179", "180", "181", "182", "183",
"184", "185", "186", "187", "188", "189", "190", "191", "192",
"193", "194", "195", "196", "197", "198", "199", "200", "201",
"202", "203", "204", "205", "206", "207", "208", "209", "210",
"211", "212", "213", "214", "215", "216", "217", "218", "219",
"220", "221", "222", "223", "224", "225", "226", "227", "228",
"229", "230", "231", "232", "233", "234", "235", "236", "237",
"238", "239", "240"), class = "factor"), cancer_treatment_modality_nt_cis_rt_cis_rt = c("NT",
"NT", "NT", "NT", "NT", "NT", "NT", "NT", "Cis", "Cis", "Cis",
"Cis", "Cis", "Cis", "Cis", "Cis", "RT", "RT", "RT", "RT", "RT",
"RT", "RT", "RT", "Cis+RT", "Cis+RT", "Cis+RT", "Cis+RT", "Cis+RT",
"Cis+RT", "Cis+RT", "Cis+RT", "NT", "NT", "NT", "NT", "NT", "NT",
"NT", "NT", "Cis", "Cis", "Cis", "Cis", "Cis", "Cis", "Cis",
"Cis", "RT", "RT", "RT", "RT", "RT", "RT", "RT", "RT", "Cis+RT",
"Cis+RT", "Cis+RT", "Cis+RT", "Cis+RT", "Cis+RT", "Cis+RT", "Cis+RT",
"NT", "NT", "NT", "NT", "NT", "NT", "NT", "NT", "Cis", "Cis",
"Cis", "Cis", "Cis", "Cis", "Cis", "Cis", "RT", "RT", "RT", "RT",
"RT", "RT", "RT", "RT", "Cis+RT", "Cis+RT", "Cis+RT", "Cis+RT",
"Cis+RT", "Cis+RT", "Cis+RT", "Cis+RT", "NT", "NT", "NT", "NT",
"NT", "NT", "NT", "NT", "Cis", "Cis", "Cis", "Cis", "Cis", "Cis",
"Cis", "Cis", "RT", "RT", "RT", "RT", "RT", "RT", "RT", "RT",
"Cis+RT", "Cis+RT", "Cis+RT", "Cis+RT", "Cis+RT", "Cis+RT", "Cis+RT",
"Cis+RT", "NT", "NT", "NT", "NT", "NT", "NT", "NT", "NT", "Cis",
"Cis", "Cis", "Cis", "Cis", "Cis", "Cis", "Cis", "RT", "RT",
"RT", "RT", "RT", "RT", "RT", "RT", "Cis+RT", "Cis+RT", "Cis+RT",
"Cis+RT", "Cis+RT", "Cis+RT", "Cis+RT", "Cis+RT", "NT", "NT",
"NT", "NT", "NT", "NT", "NT", "NT", "Cis", "Cis", "Cis", "Cis",
"Cis", "Cis", "Cis", "Cis", "RT", "RT", "RT", "RT", "RT", "RT",
"RT", "RT", "Cis+RT", "Cis+RT", "Cis+RT", "Cis+RT", "Cis+RT",
"Cis+RT", "Cis+RT", "Cis+RT", "NT", "NT", "NT", "NT", "NT", "NT",
"NT", "NT", "Cis", "Cis", "Cis", "Cis", "Cis", "Cis", "Cis",
"Cis", "RT", "RT", "RT", "RT", "RT", "RT", "RT", "RT", "Cis+RT",
"Cis+RT", "Cis+RT", "Cis+RT", "Cis+RT", "Cis+RT", "Cis+RT", "Cis+RT",
"NT", "NT", "NT", "NT", "Cis", "Cis", "Cis", "Cis", "RT", "RT",
"RT", "RT", "Cis+RT", "Cis+RT", "Cis+RT", "Cis+RT"), cis_0_1 = structure(c(1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 1L,
1L, 1L, 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 1L, 1L, 1L, 2L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 2L, 2L, 2L,
2L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 2L, 2L,
2L, 2L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 2L,
2L, 2L, 2L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 1L, 1L, 1L, 1L,
2L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 1L, 1L, 1L,
1L, 2L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 1L, 1L,
1L, 1L, 2L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 1L,
1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L), .Label = c("1", "2"), class = "factor"),
cell_tox = c(3831, 3416.75, 2960, 3339, 4179.991, 2657.449,
3081.616, 3402.351, 10322.25, 11011.5, 10992.75, 11671, 9870.186,
11652.73, 10270.16, 13599.91, 13341.75, 13729.5, 15161.5,
14897, 12713.48, 14003.69, 12051.5, 11618.97, 17350.5, 17667,
19013.5, 17817, 14130.19, 14504.74, 15996.64, 15343.1, 2854.75,
2940, 3529.75, 3017.25, 3300.817, 2230.435, 2816.393, 2995.739,
6643.5, 7083.25, 6600.25, 8178.5, 5853.885, 6251.482, 7142.517,
5271.722, 9845.75, 9205.5, 9771.5, 10747.75, 8554.357, 9328.768,
10545.55, 10211.05, 11872, 11451.75, 11604.25, 12196.25,
10044.5, 11439.07, 10043.45, 12267.24, 2396, 2528.75, 3578.5,
2492.25, 2196.274, 2655.077, 3063.587, 2605.733, 5726.25,
6690, 5469.5, 7239.5, 6201.664, 5503.733, 5797.424, 5350.008,
9174.5, 10113.25, 9312.5, 9312, 9177.329, 8533.627, 9355.823,
9587.374, 11135.5, 11683.25, 9421.75, 9070.5, 10407.81, 9491.802,
9618.997, 10025.88, 2348.5, 2253.5, 1942, 2588, 2288.319,
2738.107, 2080.981, 2514.162, 4503.25, 4561.5, 4399, 4239.75,
3988.309, 4006.338, 4803.431, 6333.089, 8406.75, 8144.75,
8000.5, 7933.5, 8477.76, 7412.418, 8569.466, 7579.317, 8824,
8863.75, 7112.25, 8786.5, 9746.191, 8685.768, 9798.545, 9985.12,
2259.25, 2183.75, 2601.75, 2327, 2367.08, 3049.353, 2152.624,
2590.55, 3372.75, 3728.5, 3561.75, 4004, 4270.612, 4990.842,
4884.089, 4752.663, 8792.75, 7210.5, 7661.75, 7807, 9318.93,
8284.508, 8315.429, 7525.558, 8278, 7858, 8171, 7808.25,
9046.27, 9393.42, 9661.161, 8358.647, 2345, 2631.5, 2737.75,
3441, 2493.761, 2205.289, 2356.167, 2762.305, 4303.5, 3856.5,
3751.5, 4334.75, 4841.862, 3905.753, 4342.73, 3954.148, 8243.25,
7800, 7123, 8445, 8900.102, 8698.066, 8347.403, 8166.098,
8679.5, 8971.25, 9158.75, 7506, 8472.489, 9363.905, 9012.89,
9119.003, 2250.5, 2557.5, 2192.75, 3119.25, 2443.468, 2440.621,
1792.035, 2482.373, 3079, 3666.25, 3694, 3493, 2966.797,
3649.545, 4787.299, 3615.383, 7765, 7076.75, 7710, 7961.5,
7288.737, 8126.394, 8749.014, 8084.581, 9296, 8396, 8145.75,
8139.75, 8519.924, 8898.345, 8556.817, 7979.523, 2460.074,
2006.016, 1627.871, 2402.19, 2607.156, 2027.841, 3266.655,
2753.764, 9234.954, 8680.147, 8561.736, 13133.71, 8656.254,
9102.84, 8920.481, 11059.25)), class = "data.frame", row.names = c(NA,
240L))
1条答案
按热度按时间myss37ts1#
是的,您是正确的,因为如果每个水平仅存在一个观测,则通常无法拟合随机效应。删除
no
项后的奇异拟合很可能是由于随机截距仅具有两个水平。如果要拟合随机截距,建议因子至少具有六个水平。请参见此处的讨论:https://stats.stackexchange.com/questions/37647/what-is-the-minimum-recommended-number-of-groups-for-a-random-effects-factor如果您查看模型中的随机效应,您会发现它无法估计随机截距,并且将其报告为零。
由于估计值为零,因此应与不含该项的模型相同。我们可以拟合线性模型,将随机截距作为固定效应。混合模型可能不适用于此数据。