rwarningsgenetics

Warning message clarification


I'm using SNPassoc R package for finding association between data SNPs and a continuous variable outcome. I run the analysis and I got the results; however, I got warning message which is:

Warning in terms.formula(formula, data = data) :
  'varlist' has changed (from nvar=3) to new 4 after EncodeVars() -- should no longer happen!

my model is:

model <- WGassociation (continuous variable ~ covariate +covariate+ covariate  ,data= data)
model

I don't know what it means and should I worry about it or ignore it? Can you please help me?


Solution

  • This warning message is coming glm, which is used by SNPassoc::WGassociation, see this line on GitHub.

    Warning message is saying that it is dropping some variable as it is a linear combination of other existing variables in the model.

    To reproduce this warning try below example:

    # 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
    

    Now add useless combo variable which is constructed from existing variables.

    # 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!