# Empirical Test for the Assumptions of Simple Linear Regression

Linear Regression has the below set of Assumptions,

1. The Y-Values (or the errors, "e") are independent!
2. The Y-Values can be expressed as a linear function of the X variable.
3. Variation of observations around the regression line (the residual SE) is constant (homoscedasticity).
4. For given value of X, Y values (or the error) are Normally distributed.

Is there any empirical test instead of visual test in R that can be used to validate the Assumptions in 1, 2 and 4?

I can only find for Assumption 3, Empirical Test: ncvTest() from CAR package Value to be observed: p-value Pass criteria: > 0.05

This is to make an automated script that can assist to choose the best model for a set non linear data using linear regression.

Do assist to point to any books or website if this has been discussed previously as my search has been futile. I find many approaches are visual based then empirical.

• You might find Chapter 7 of his PDF useful Feb 14 '15 at 2:24
• By 'empirical test' do you mean 'hypothesis test' or something else? Feb 16 '15 at 3:06
• @Glen_b Many of the above tests depend on visual inspection to arrive at conclusion i.e subjective and require experience. I am trying to create a script where the assumptions could be empirically (by value) tested rather than visual. For example to test for Assumption 3 above, if p-value > 0.05 in ncvTest() in R Language, can conclude the error is homoscedastic. I am futile to find similar test for other assumptions in R Language Feb 17 '15 at 12:42
• Formal hypothesis testing of assumptions quite literally answers the wrong question. Diagnostic visual assessment comes much closer to answering a meaningful question (though can still impact inference in much the same way that formal testing does). Feb 18 '15 at 11:28

There is a lot of merit in @Glen_b comment, you should not over rely on tests. They usually come with assumptions, and can lead you into situations where the usual p-values are no longer valid. Regression analysis is much more than simply testing some assumptions, and even if you fail to reject the nulls it's doesn't automatically imply that you are doing something profoundly meaningful. That said, here goes my answer.

1. You will have some indication directly based on how you obtained the sample. The assumption is guaranteed to be true if you used random sampling. Otherwise you likely have some form of serial dependence, there is no general catch all test, and so the simply option is to use robust standard errors if you care about inference.

2. There is really no test for this. You could look at some plots between X and Y and determine if you think it looks reasonable. But this only feasible when you have only a few variables. If you are worried about this, you could look into kernel regression or spline fitting. Actually, as it turns out, you still estimate (consistently) the best linear approximation if the assumption is false.

3. You might to consider White's general test. But again you could just opt for robust errors if you care about inference.

4. You don't really need this assumption. Normality only holds value if your model delivers on the full set of assumptions (aka. The Gauss Markov assumptions). And even then, the only value added is exact inference in small samples. Here it is worth considering the nature of the Y variable. If you are modelling income, for example, you know the assumption is false because income is never negative.

You can test independence of errors with the function durbinWatsonTest() from CAR package, aditionally take a look of packages gvlma and lmtest, first gives you a function for global validation of linear models assumptions, second provides a rich variety of diagnostic test for avoid pitfalls in the applying of linear models. Cheers.

• Durbin-Watson only checks for temporal correlation and obviously fails for other forms of dependence. Feb 19 '15 at 21:02
• That's exactly the reason for other diagnostic test incluiding in lmtest package, Thank you Feb 19 '15 at 23:42
• Please don't use the Durbin Watson test, it only tests for AR (1) errors and is only valid under the full set of linear model assumptions. There are much simpler, more robust, and more general tests readily available Oct 10 '17 at 19:53