diagTestMatrixPLM.Rd
Table of diagnostic tests for panel linear regression models: null hypothesis, value, and decision based on user-defined significance threshold level.
diagTestMatrixPLM(x, decim = 4, prob = 0.05, FEM, REM)
An object of class plm.
Specifies the number of decimals to display. The default is 4.
Specifies the threshold for rejecting the null hypothesis. The default is 0.05.
An object of class plm. If x is POLS model, specifies the Fixed Effects model to be compared with for the Ftest.
An object of class plm. If FEM is specified, REM specifies the Random Effects model to be compared with for the Hausman test.
A matrix with the null hypothesis, statistic, p-value, number of stars, and the interpretation of the tests' results. Significance stars follow the social sciences standards. The rownames are the tests' names: F-test, Hausman test, B-P/LM test of independence, Pasaran CD test of independence, Breusch-Godfrey/Wooldridge test for serial correlation in panel models, and Breusch-Pagan test for heteroskedasticity. Builds on plm and lmtest packages. Adds the interpretation of the tests' results. The function does not decide which tests are appropriate to be used for the regression model provided. This remains at the researcher's discretion. For e.g. the function compiles the Breusch-Pagan test for heteroskedasticity even if the model provided in argument x is a random effects one.
Croissant, Y. et al.(2022), Package ‘plm’:linear models for panel data (Version 2.6-2). https://cran.r-project.org/package=plm Hothorn, T. et al. (2022), Package ‘lmtest’: Testing Linear Regression Models (Version 0.9-40). https://CRAN.R-project.org/package=lmtest
library(plm)
data("Grunfeld", package = "plm") ###use the models from plm package (Croissant Y. et al, 2022: pg.4):
pooledOLS=plm(inv ~ value + capital, data = Grunfeld, model="pooling")
tests=diagTestMatrixPLM(pooledOLS)
#> Loading required package: lmtest
#> Loading required package: zoo
#>
#> Attaching package: 'zoo'
#> The following objects are masked from 'package:base':
#>
#> as.Date, as.Date.numeric
#View(tests)
#write.csv(tests, "POLStests.csv")
FE=plm(inv ~ value + capital, data = Grunfeld, model="within")
RE=plm(inv ~ value + capital, data = Grunfeld, model="random")
tests=diagTestMatrixPLM(pooledOLS, 2, 0.01, FE)
#View(tests)
tests=diagTestMatrixPLM(pooledOLS,FEM=FE, REM=RE)
#View(tests)
#' #***, **, * represent statistical significance at 1%, 5%, and 10%, respectively.