警告信息澄清

3
我使用 SNPassoc R软件包来寻找数据SNPs和连续变量结果之间的关联。我运行了分析并获得了结果,但是我收到了警告消息,内容如下:
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

我不知道它的意思,我应该担心它还是忽略它?你能帮我吗?

1个回答

3

这个警告信息来自于被 SNPassoc::WGassociation 使用的 glm。请参考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!

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接