首页 > 解决方案 > 为大量固定效应预测器运行 glmer 时出现多个错误

问题描述

我正在从包 lme4 运行 glmer,以从大量预测变量中预测二进制结果 an_larv_bin。预测变量多为数值型,3个为因子。

这就是我运行的:

point3 <- glmer(an_larv_bin ~  month + TRMM_20150 + EVI + NDVI + houseDist + DEM + Euc_Recent + Built_Euc + Acacia_Euc + Water_Euc + Intact_For + Clearing_E + Bush_Euc_D + Rice_Euc_D + Palm_Euc_D + Mix_Euc_Di + Rubber_Euc + Aspect_Map + Slope_Map + TWI_Map + density_v + diversity + (1|water_body_id), family="binomial", data=points3) 
    

我在运行模型时遇到以下警告消息:

 Warning messages:
1: Some predictor variables are on very different scales: consider rescaling 
2: In (function (fn, par, lower = rep.int(-Inf, n), upper = rep.int(Inf,  :
  failure to converge in 10000 evaluations
3: In checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv,  :
  unable to evaluate scaled gradient
4: In checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv,  :
  Model failed to converge: degenerate  Hessian with 3 negative eigenvalues

当我运行时:

summary(point3)

我收到以下警告消息:

    Correlation matrix not shown by default, as p = 44 > 12.
Use print(x, correlation=TRUE)  or
    vcov(x)        if you need it

fit warnings:
Some predictor variables are on very different scales: consider rescaling
convergence code: 0
unable to evaluate scaled gradient
Model failed to converge: degenerate  Hessian with 3 negative eigenvalues
failure to converge in 10000 evaluations

Warning messages:
1: In vcov.merMod(object, use.hessian = use.hessian) :
  variance-covariance matrix computed from finite-difference Hessian is
not positive definite or contains NA values: falling back to var-cov estimated from RX
2: In vcov.merMod(object, correlation = correlation, sigm = sig) :
  variance-covariance matrix computed from finite-difference Hessian is
not positive definite or contains NA values: falling back to var-cov estimated from RX

我重新调整了所有变量并遇到了相同的警告。

这是我正在使用的数据

> dput(points3[1:5, c(1, 3, 13, 26, 48:68)])
structure(list(samp_id = c(274L, 1L, 275L, 276L, 2L), month = c("may", 
"may", "may", "may", "may"), water_body_id = c("4937_PO1", "3270_IS1", 
"2854_IS1", "3270_IS2", "2582_RV1"), an_larv_bin = c(1L, 0L, 
1L, 1L, 0L), TRMM_20150 = c(0.107319515, 0.049805214, 0.049805214, 
0.049805214, 0.118292061), EVI = c(0.499929994, 0.589900017, 
0.593994021, 0.589900017, 0.601158023), NDVI = c(0.691016972, 
0.798900008, 0.782992005, 0.798900008, 0.772291005), houseDist = c(364.0050049, 
50.99020004, 67.08200073, 50.99020004, 67.08200073), DEM = c(31L, 
24L, 26L, 24L, 26L), Euc_Recent = c(30, 84.85279846, 84.85279846, 
84.85279846, 84.85279846), Built_Euc = c(150.0070038, 60.00289917, 
60.00289917, 60.00289917, 60.00289917), Acacia_Euc = c(23827.69922, 
21825, 21825, 21825, 21825), Water_Euc = c(1213.47998, 201.2559967, 
201.2559967, 201.2559967, 201.2559967), Intact_For = c(18160.40039, 
18621.69922, 18621.69922, 18621.69922, 18621.69922), Clearing_E = c(0, 
67.08529663, 67.08529663, 67.08529663, 67.08529663), Bush_Euc_D = c(523.9530029, 
305.9559937, 305.9559937, 305.9559937, 305.9559937), Rice_Euc_D = c(174.9369965, 
390.0190125, 390.0190125, 390.0190125, 390.0190125), Palm_Euc_D = c(218.4140015, 
0, 0, 0, 0), Mix_Euc_Di = c(192.1029968, 30.00139999, 30.00139999, 
30.00139999, 30.00139999), Rubber_Euc = c(84.85690308, 212.1419983, 
212.1419983, 212.1419983, 212.1419983), Aspect_Map = c(189.1159973, 
163.423996, 163.423996, 163.423996, 163.423996), Slope_Map = c(13.28279972, 
5.421599865, 5.421599865, 5.421599865, 5.421599865), TWI_Map = c(4.844860077, 
5.756090164, 5.756090164, 5.756090164, 5.756090164), density_v = c("sparse", 
"planted", "dense", "dense", "sparse"), diversity = c("bush", 
"monoculture", "farmed_mixed", "farmed_mixed", "mixed_forest"
)), row.names = c(NA, 5L), class = "data.frame")

任何帮助将不胜感激!

标签: rlme4mixed-models

解决方案


推荐阅读