r - 警告信息说明

标签 r warnings genetics

我正在使用 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/

相关文章:

R/GIS : How to subset a shapefile by a lat-long bounding box?

r - 模拟每两个变量之间具有不同混合依赖结构的混合数据?

php - "Notice: Undefined variable"、 "Notice: Undefined index"、 "Warning: Undefined array key"和 "Notice: Undefined offset"使用 PHP

python - 如何在 python 中使用 matplotlib 创建曼哈顿图?

bioinformatics - 如何将所有染色体合并到一个文件中

linux - 如何从染色体 :position numbers? 中删除前导零

r - 有没有case-control匹配的包(个人1 :N matching) in R (NOT propensity score matching)?

r - 在 R 中使用 lapply 生成具有不同参数的随机数

ios - XCode 6.3 警告 : Comparison of address of 'myObject' not equal to null pointer is always true

internet-explorer - 在 Internet Explorer 中查找不安全的项目