这个问题似乎是重复的,但是我无法通过查看模型上的现有建议来解决我的情况。我正在尝试拟合三级随机截距模型。这个想法是建立影响实践的因素,并理解个人嵌套在家庭中,而后者嵌套在区域中。我的数据集可以通过此网址访问https://drive.google.com/file/d/1rY7n_pNh4TQ6B7SKCo03-TfmGnxzYRMf/view?usp=sharing
这是模型:
model <- glmer(
Practice ~ Zone + Access + Age + Gender + Education + Employnment + (1 | ZoneID/HouseID),
data = OshingaliMLM,family = binomial(link = "logit"),nAGQ = 0
)
我得到以下结果:
Generalized linear mixed model fit by maximum likelihood (Adaptive Gauss-Hermite Quadrature, nAGQ = 0) ['glmerMod']
Family: binomial ( logit )
Formula: Practice ~ Zone + Access + Age + Gender + Education + Employnment + (1 | ZoneID/HouseID)
Data: OshingaliMLM
AIC BIC logLik deviance df.resid
36.0 108.3 0.0 0.0 392
Scaled residuals:
Min 1Q Median 3Q Max
-1.49e-08 1.49e-08 1.49e-08 1.49e-08 1.49e-08
Random effects:
Groups Name Variance Std.Dev.
HouseID:ZoneID (Intercept) 0.054 0.2324
ZoneID (Intercept) 0.000 0.0000
Number of obs: 410, groups: HouseID:ZoneID, 121; ZoneID, 5
Fixed effects:
Estimate Std. Error z value Pr(>|z|)
(Intercept) -3.957e+01 6.711e+07 0 1
ZonePeri-urban 7.908e+01 7.158e+07 0 1
ZoneRemote rural 7.897e+01 7.149e+07 0 1
ZoneRural 7.917e+01 7.139e+07 0 1
ZoneUrban 7.912e+01 7.200e+07 0 1
AccessNo -1.560e-01 1.893e+07 0 1
Age10-30 2.233e-02 2.073e+07 0 1
Age31-51 -4.631e-02 1.998e+07 0 1
Age52-72 -2.009e-02 1.613e+07 0 1
GenderFemale 6.587e-02 7.014e+06 0 1
EducationNo_education 2.096e-01 1.919e+07 0 1
EducationPrimary 2.307e-01 1.599e+07 0 1
EducationSecondary 1.194e-01 1.507e+07 0 1
EmploynmentEmployed 2.006e-01 1.825e+07 0 1
EmploynmentLeaners -1.119e-01 1.097e+07 0 1
EmploynmentPensioners -9.502e-02 1.628e+07 0 1
Correlation matrix not shown by default, as p = 16 > 12.
Use print(x, correlation=TRUE) or
vcov(x) if you need it
fit warnings:
fixed-effect model matrix is rank deficient so dropping 5 columns / coefficients
optimizer (bobyqa) convergence code: 0 (OK)
boundary (singular) fit: see help('isSingular')
这个问题出现在我将年龄分为四个不同的类别并将其作为一个因素读取之后,但即使在删除年龄只是为了测试之后,它也出现了同样的问题,但现在说删除 4 列。我尝试删除不同的预测列,它似乎在抱怨所有这些列。我尝试过`OshingaliMLM$Age <- as.numeric(as.character(OshingaliMLM$Age)) and now complaining about invalid grouping factor specification. dput(head(OshingaliMLM,50)) shows that there are NAs for age and I am unable to solve it yet.
排名不足,因此通过不对年龄预测变量进行分类并将其读取为数值而不是因子来解决删除 5 列/系数的问题,而排名不足是通过从模型中删除 ZoneID 来解决的,因为没有变化。