title: R - Testing for homo/heteroscedasticity and collinearity in a multivariate regression model
body: <p>I'm trying to optimize a multivariate linear regression model <code>lmMod=lm(depend_var~var1+var2+var3+var4....,data=df)</code> and I'm presently working on the premises of the model: the constant variance of residuals and the absence of auto-correlation. For this I'm using:</p>
  
  <ul>
  <li><p>Breusch-Pagan test for homo/heteroscedasticity: <code>lmtest::bptest(lmMod)</code> </p></li>
  <li><p>Durbin Watson test for auto-correlation: <code>durbinWatsonTest(lmMod)</code></p></li>
  </ul>
  
  <p>I found examples which are testing either one independent variable at a time:</p>
  
  <p><strong>example for Breush-Pagan test – one independent variable:</strong>
  <a href="https://datascienceplus.com/how-to-detect-heteroscedasticity-and-rectify-it/" rel="nofollow noreferrer">https://datascienceplus.com/how-to-detect-heteroscedasticity-and-rectify-it/</a></p>
  
  <p><strong>example for Durbin Watson test - one independent variable:</strong>
  <a href="http://math.furman.edu/~dcs/courses/math47/R/library/lmtest/html/dwtest.html" rel="nofollow noreferrer">http://math.furman.edu/~dcs/courses/math47/R/library/lmtest/html/dwtest.html</a></p>
  
  <p>or the whole model with several independent variables at a time:</p>
  
  <p><strong>example for Durbin Watson test – multiple independent variable:</strong>
  <a href="https://www.rdocumentation.org/packages/car/versions/2.1-6/topics/durbinWatsonTest" rel="nofollow noreferrer">https://www.rdocumentation.org/packages/car/versions/2.1-6/topics/durbinWatsonTest</a></p>
  
  <p>Here are the questions:</p>
  
  <ol>
  <li>Can <code>durbinWatsonTest()</code> and <code>bptest()</code> be fed with a whole multivariate model</li>
  <li>If answer to 1 is yes, how is it then possible to determine which variable is causing heteroscedasticity or auto-correlation in the model in order to fix it as each of those tests give only one p-value for the entire multivariate model?</li>
  <li>If answer to 1 is no, the test should be then performed with one dependent variable at a time. But in the case of homoscedasticity, it can only be tested AFTER a particular regression has been modelled. Hence a pattern of homo/heteroscedasticity in an univariate regression model <code>lmMod_1=lm(depend_var~var1, data=df)</code> will be different from the pattern of a multivariate regression model <code>lmMod_2=lm(depend_var~var1+var2+var3+var4....,data=df)</code></li>
  </ol>
  
  <p>Thank very much in advance for your help!</p>