You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

数据结构问题致所有模型触发'isSingular'错误求助

数据结构问题导致模型拟合失败排查

我发现数据存在潜在结构问题,所有模型运行均失败。尝试使用nlme、lmer的线性混合效应模型,以及重复测量方差分析时,每次都遇到不同形式的model is singular错误:

线性混合效应模型(nlme)

lme.totalmoss3 <- lme(moss_TOT ~ permafrost*year, data = veg1,
    random =  ~ 1 | plot, method="REML", na.action = na.omit)
intervals(lme.totalmoss3) # 近似95%置信区间

输出结果:

近似95%置信区间
固定效应: lower est. upper
(Intercept) -1.582048 3.783333 9.148714
permafrostNOICE -10.670785 -1.928788 6.813209
year2021 14.920823 22.535000 30.149177
permafrostNOICE:year2021 -2.574414 9.788636 22.151687

随机效应:
层级: plot
                    lower          est.         upper

sd((Intercept)) 3.564458e-55 0.001182198 3.92091e+48

组内标准误:
           lower      est.     upper
        9.202664 11.112724 13.419226

模型运行异常,原以为是功效问题,转而尝试方差分析。

线性混合效应模型(lmer)

lme.totalmoss3 <- lmer(moss_TOT ~ permafrost * year + (1 | plot),
   data = veg1, REML = TRUE, na.action = na.omit)

报错信息:

boundary (singular) fit: see help('isSingular')

重复测量方差分析

aov.totalmoss3 <- aov(moss_TOT ~ permafrost * year +
        Error(plot/(permafrost * year)), data = veg1)

警告信息:

Warning message: In aov(moss_TOT ~ permafrost * year + Error(plot/permafrost * year), : Error() model is singular

重复测量方差分析(另一种实现方式)

aov.totalmoss3 <- anova_test(data = veg1,
    dv = moss_TOT,
    wid = plot,
    within = c(permafrost, year),
    effect.size = 'pes')

报错信息:

Error in lm.fit(x, y, offset = offset, singular.ok = singular.ok, ...) : 0 (non-NA) cases

我正在研究多年冻土状态(有冰/无冰)和年份(2015、2021)对苔藓总覆盖百分比(moss_TOT)的影响。因数据保密无法提供完整数据表,以下是列标题及数据概要:

数据共68行,summary(lme.totalmoss3$data)输出:

unique_id plot year time water
Length:68 Length:68 Min. :2015 Min. :1.0 Min. : 0.00
Class :character Class :character 1st Qu.:2015 1st Qu.:1.0 1st Qu.: 0.00
Mode :character Mode :character Median :2018 Median :1.5 Median : 0.00
Mean :2018 Mean :1.5 Mean : 0.77
3rd Qu.:2021 3rd Qu.:2.0 3rd Qu.: 0.00
Max. :2022 Max. :2.0 Max. :23.00

bare sphagnum cerat_pohlia feathermoss other_moss_sp
Min. : 0.000 Min. : 0.000 Min. : 0.000 Min. : 0.0000 Min. : 0.000
1st Qu.: 5.287 1st Qu.: 0.000 1st Qu.: 0.475 1st Qu.: 0.0000 1st Qu.: 0.000
Median : 62.335 Median : 0.000 Median : 0.000 Median : 3.730 Median : 0.0000
Mean : 56.830 Mean : 1.092 Mean :12.520 Mean : 0.8062 Mean : 1.644
3rd Qu.:100.525 3rd Qu.: 0.000 3rd Qu.:20.927 3rd Qu.: 0.0000 3rd Qu.: 0.595
Max. :191.200 Max. :41.000 Max. :30.540 Max. :58.150 Max. :15.0000

moss_TOT sp_richness permafrost permafrost_time
Min. : 0.000 Min. :0.000 Length:68 Length:68
1st Qu.: 0.675 1st Qu.:1.000 Class :character Class :character
Median : 9.300 Median :1.000 Mode :character Mode :character
Mean :16.015 Mean :1.529
3rd Qu.:28.270 3rd Qu.:2.000
Max. :66.620 Max. :3.000

region ecoregion
Length:68 Length:68
Class :character Class :character
Mode :character Mode :character


内容的提问来源于stack exchange,提问作者Jane

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.11 19:40:26