36
$\begingroup$

While building a regression model in R (lm), I am frequently getting this message

"there are aliased coefficients in the model"

What exactly does it mean?

Also, due to this predict() is also giving a warning.

Though it's just a warning, I want to know how can we detect/remove aliased coefficients before building a model.

Also, what are the probable consequences of neglecting this warning?

$\endgroup$

3 Answers 3

41
$\begingroup$

I suspect this is not an error of lm, but rather vif (from package car). If so, I believe you have ran into perfect multicollinearity. For instance

x1 <- rnorm( 100 )
x2 <- 2 * x1
y <- rnorm( 100 )
vif( lm( y ~ x1 + x2 ) )

produces your error.

In this context, ''alias'' refers to the variables that are linearly dependent on others (i.e. cause perfect multicollinearity).

The first step towards the solution is to identify which variable(s) are the culprit(s). Run

alias( lm( y ~ x1 + x2 ) )

to see an example.

$\endgroup$
2
  • $\begingroup$ Thanks. Is 'multicollinearity' same as having 'aliased coefficients' ? $\endgroup$ Commented Aug 19, 2014 at 11:35
  • 1
    $\begingroup$ @MohitVerma : In this terminology ''alias'' refers to the variables that are linearly dependent (i.e. cause perfect multicollinearity). See stat.ethz.ch/R-manual/R-patched/library/stats/html/alias.html . I update the answer with this. $\endgroup$ Commented Aug 19, 2014 at 11:41
6
$\begingroup$

This often comes up when you have singularities in your regression X'X matrix (NA values in the summary of the regression output).

Base R lm() allows for singular values/perfect multicollinearity as the default is singular.ok = TRUE. Other packages/functions are more conservative.

For example, for the linearHypothesis() function in the car package, the default is singular.ok = FALSE. If you have perfect multicollinearity in your regression, linearHypothesis() will return an error "there are aliased coefficients in the model". To deal with this error, set singular.ok = TRUE. Be careful, however, as doing this may mask perfect multicollinearity in your regression.

$\endgroup$
3
$\begingroup$

maybe to good to know for some: I got this error as well when I added dummies to a regression. R automatically omit one dummy, but this causes an error in the vif test. so a solution, for some, might be removing one dummy manually.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.