Can anyone tell me how to tell if the predictors I am using are collinear and can not be used in a `geeglm` model? What is the value and is calculating the correlation the correct way of determining it?
['https://stats.stackexchange.com/questions/236953', 'https://stats.stackexchange.com', 'https://stats.stackexchange.com/users/115530/']
You can start by looking at the Pearson pariwise correlations to get the strength and direction of the linear association between any two (continuous) predictors. This can give you some insights about the data. In R you can use:
`cor(dat[,names(dat)], use ="pairwise", method = "pearson")`

However, there is no exact threshold at which we can say that collinearity is too high (unless, of course, the Pearson correlation coefficient equals 1). If you try to fit a linear model, pairwise correlations are not the sole problem, we can have collinearity between more than two variables… We commonly evaluate multicollinearity through Variance Inflation Factors (VIFs). In R, after fitting the model we can use `vif(model)` from the package ‘car’. This gives the correlations between each predictor and all the other predictors used in the model. The rule of thumb is that VIF should not be larger than 10. If so, you remove the variable having the highest VIF, re-run the model and check again the VIF.

It may be sometimes that the predictor that you need to remove (according to VIF) is your predictor of interest (this can happen when your aim is not prediction, but rather to identify how certain predictors affect the outcome variable). In that case, you keep your predictor and look at the Pearson pairwise correlation matrix to identify which predictors are highly correlated with your main predictor and remove them one by one while checking VIF.
If what you are after is a list of covariates that are not collinear, you can use `lm()` to do the job for you. 
Here is an example (with simulated data):

```
# Simulate data
x1 <- runif(100)
x2 <- runif(100)
x3 <- x1 + x2
y <- x1+x2+rnorm(100)
dat <- data.frame(y,x1,x2,x3)

# Run lm() on your data
reg <- lm(y~.,dat)
# Here is the list! 
intersect(names(dat),names(reg$coef[!is.na(reg$coef)]))

```