我正尝试使用混合效应模型,将其余的列作为预测变量来预测F2_difference
,但是我收到了一个错误信息:
fixed-effect model matrix is rank deficient so dropping 7 columns / coefficients.
根据这个链接Fixed-effects model is rank deficient,我认为我应该在R包caret
中使用findLinearCombos
。然而,当我尝试使用findLinearCombos(data.df)
时,它会给我一个错误信息:
Error in qr.default(object) : NA/NaN/Inf in foreign function call (arg 1) In addition: Warning message: In qr.default(object) : NAs introduced by coercion
我的数据中没有任何缺失值,可能是什么原因导致这种情况?(如果答案显而易见,抱歉 - 我是R新手。)我的所有数据都是因子,除了我要预测的数值。这是我的数据的一个小样本。
sex <- c("f", "m", "f", "m")
nasal <- c("TRUE", "TRUE", "FALSE", "FALSE")
vowelLabel <- c("a", "e", "i", "o")
speaker <- c("Jim", "John", "Ben", "Sally")
word_1 <- c("going", "back", "bag", "back")
type <- c("coronal", "coronal", "labial", "velar")
F2_difference <- c(345.6, -765.8, 800, 900.5)
data.df <- data.frame(sex, nasal, vowelLabel, speaker,
word_1, type, F2_difference
stringsAsFactors = TRUE)
编辑: 这里有更多的代码,如果有帮助的话。
formula <- F2_difference ~ sex + nasal + type + vowelLabel +
type * vowelLabel + nasal * type +
(1|speaker) + (1|word_1)
lmer(formula, REML = FALSE, data = data.df)
编辑编辑:
原帖没有提供足够数量的测试数据,不能让读者实际运行lmer
模型。但这不是太大的问题。这仍然是一篇非常好的帖子!