我正在使用 SNPassoc用于查找数据 SNP 与连续变量结果之间关联的 R 包。我运行分析并得到结果;但是,我收到警告消息:
Warning in terms.formula(formula, data = data) :
'varlist' has changed (from nvar=3) to new 4 after EncodeVars() -- should no longer happen!
我的模型是:
model <- WGassociation (continuous variable ~ covariate +covariate+ covariate ,data= data)
model
我不知道这意味着什么,我应该担心还是忽略它? 你能帮帮我吗?
最佳答案
此警告消息即将出现 glm,它由 SNPassoc::WGassociation 使用,see this line on GitHub .
警告消息说它正在删除一些变量,因为它是模型中其他现有变量的线性组合。
要重现此警告,请尝试以下示例:
# data
x <- mtcars[, 1:4]
# run model, all good
glm(mpg ~ ., data = x)
# Call: glm(formula = mpg ~ ., data = x)
#
# Coefficients:
# (Intercept) cyl disp hp
# 34.18492 -1.22742 -0.01884 -0.01468
#
# Degrees of Freedom: 31 Total (i.e. Null); 28 Residual
# Null Deviance: 1126
# Residual Deviance: 261.4 AIC: 168
现在添加无用的组合变量,它是从现有变量构造的。
# make a combo var
cyldisp <- x$cyl + x$disp
# run model with combo var, now we get the warning
glm(mpg ~ . + cylmpg, data = x)
# Call: glm(formula = mpg ~ . + cyldisp, data = x)
#
# Coefficients:
# (Intercept) cyl disp hp cyldisp
# 34.18492 -1.22742 -0.01884 -0.01468 NA
#
# Degrees of Freedom: 31 Total (i.e. Null); 28 Residual
# Null Deviance: 1126
# Residual Deviance: 261.4 AIC: 168
# Warning message:
# In terms.formula(formula, data = data) :
# 'varlist' has changed (from nvar=4) to new 5 after EncodeVars() -- should no longer happen!
关于r - 警告信息说明,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68608255/