Skip to content

Linearity in Parameters: Ramsey RESET Test in R

Last Update: February 21, 2022

Linearity in Parameters: Ramsey RESET Test in R can be done using lmtest package resettest function for evaluating whether linear regression fitted values non-linear combinations explain dependent variable. Main parameters within resettest function are formula with y ~ x original model description, power with augmented model added independent variables powers, type with original model fitted values, independent variables or independent variables first principal component to be included as augmented model added independent variables and data with data.frame object including original model variables.

As example, we can do Ramsey RESET test on multiple linear regression of house price explained by its lot size and number of bedrooms using data included within AER package HousePrices object [1].

First, we load packages AER for data and lmtest for Ramsey RESET test [2].

In [1]:
library(AER)
library(lmtest)

Second, we create HousePrices data object from AER package using data function and print first six rows and three columns of data using head function to view data.frame structure.

In [2]:
data(HousePrices)
head(HousePrices[, 1:3])
Out [2]:
  price lotsize bedrooms
1 42000    5850        3
2 38500    4000        2
3 49500    3060        3
4 60500    6650        3
5 61000    6360        2
6 66000    4160        3

Third, as example again, we do Ramsey RESET test using resettest function. Within resettest function, parameters formula = price ~ lotsize + bedrooms fits original model where house price is explained by its lot size and number of bedrooms, power = 2 adds squared independent variable to augmented model and type = "fitted" adds original model fitted values as augmented model independent variable. Notice that resettest function parameters power = 2 and type = "fitted" were only included as educational examples which can be modified according to your needs.

In [3]:
resettest(formula = price ~ lotsize + bedrooms, data = HousePrices, power = 2, type = "fitted")
Out [3]:
	RESET test

data:  price ~ lotsize + bedrooms
RESET = 10.635, df1 = 1, df2 = 542, p-value = 0.00118

Courses

My online courses are hosted at Teachable website.

For more details on this concept, you can view my Linear Regression in R Course.

References

[1] Data Description: Sales prices of houses sold in the city of Windsor, Canada, during July, August and September, 1987.

Original Source: Anglin, P., and Gencay, R. (1996). Semiparametric Estimation of a Hedonic Price Function. Journal of Applied Econometrics, 11, 633–648.

[2] AER R Package: Christian Kleiber and Achim Zeileis. (2008). Applied Econometrics with R. Springer-Verlag, New York.

lmtest R Package: Achim Zeileis and Torsten Hothorn. (2002). Diagnostic Checking in Regression Relationships. R News, 2 (3): 7-10

My online courses are closed for enrollment.
+