Title: | Conditional Moments Test |
---|---|
Description: | Conditional moments test, as proposed by Newey (1985) <doi:10.2307/1911011 > and Tauchen (1985) <doi:10.1016/0304-4076(85)90149-6>, useful to detect specification violations for models estimated by maximum likelihood. Methods for probit and tobit models are provided. |
Authors: | Yves Croissant [aut, cre] |
Maintainer: | Yves Croissant <[email protected]> |
License: | GPL (>= 2) |
Version: | 0.1-2 |
Built: | 2024-11-12 03:40:37 UTC |
Source: | https://github.com/cran/cmtest |
Conditional moments tests for maximum likelihood estimators consist on adding to the matrix of individual contributions to the score moments conditions and then test the hypothesis that the expected value of the vector of augmented scores is zero. It is particularly convenient for the probit and the tobit model to test for functional form, omitted variables, heteroscedasticity and normaliy.
cmtest( x, test = c("normality", "reset", "heterosc", "skewness", "kurtosis"), powers = 2:3, heter_cov = NULL, OPG = FALSE ) ## S3 method for class 'tobit' cmtest( x, test = c("normality", "reset", "heterosc", "skewness", "kurtosis"), powers = 2:3, heter_cov = NULL, OPG = FALSE ) ## S3 method for class 'tobit1' cmtest( x, test = c("normality", "reset", "heterosc", "skewness", "kurtosis"), powers = 2:3, heter_cov = NULL, OPG = FALSE ) ## S3 method for class 'censReg' cmtest( x, test = c("normality", "reset", "heterosc", "skewness", "kurtosis"), powers = 2:3, heter_cov = NULL, OPG = FALSE ) ## S3 method for class 'glm' cmtest( x, test = c("normality", "reset", "heterosc", "skewness", "kurtosis"), powers = 2:3, heter_cov = NULL, OPG = FALSE )
cmtest( x, test = c("normality", "reset", "heterosc", "skewness", "kurtosis"), powers = 2:3, heter_cov = NULL, OPG = FALSE ) ## S3 method for class 'tobit' cmtest( x, test = c("normality", "reset", "heterosc", "skewness", "kurtosis"), powers = 2:3, heter_cov = NULL, OPG = FALSE ) ## S3 method for class 'tobit1' cmtest( x, test = c("normality", "reset", "heterosc", "skewness", "kurtosis"), powers = 2:3, heter_cov = NULL, OPG = FALSE ) ## S3 method for class 'censReg' cmtest( x, test = c("normality", "reset", "heterosc", "skewness", "kurtosis"), powers = 2:3, heter_cov = NULL, OPG = FALSE ) ## S3 method for class 'glm' cmtest( x, test = c("normality", "reset", "heterosc", "skewness", "kurtosis"), powers = 2:3, heter_cov = NULL, OPG = FALSE )
x |
a fitted model, currently a tobit model either fitted by
|
test |
the kind of test to be performed, either a normality test (or separately a test that the skewness or kurtosis coefficients are 0 and 3), a heteroscedasticity test or a reset test, |
powers |
the powers of the fitted values that should be used in the reset test, |
heter_cov |
a one side formula that indicates the covariates that should be used for the heteroscedasticity test (by default all the covariates used in the regression are used), |
OPG |
a boolean, if |
a list with class 'htest'
containing the following components:
data.mane: a character string describing the fitted model
statistic: the value of the test statistic
parameter: degrees of freedom
p.value: the p.value of the test
method: a character indicating what type of test is performed
Yves Croissant
Newey WK (1985). “Maximum Likelihood Specification Testing and Conditional Moment Tests.” Econometrica, 53(5), 1047–1070. ISSN 00129682, 14680262, https://www.jstor.org/stable/1911011.
Pagan A, Vella F (1989). “Diagnostic Tests for Models Based on Individual Data: A Survey.” Journal of Applied Econometrics, 4, S29–S59. ISSN 08837252, 10991255, https://www.jstor.org/stable/2096593.
Tauchen G (1985). “Diagnostic testing and evaluation of maximum likelihood models.” Journal of Econometrics, 30(1), 415-443. ISSN 0304-4076, doi:10.1016/0304-4076(85)90149-6, https://www.sciencedirect.com/science/article/pii/0304407685901496.
Wells C (2003). “Retesting Fair's (1978) Model on Infidelity.” Journal of Applied Econometrics, 18(2), 237–239. ISSN 08837252, 10991255, https://www.jstor.org/stable/30035205.
# replication of Wells (2003) and Pagan and Vella (1989) using Fair's data library("AER") data("Affairs", package = "AER") z <- tobit(affairs ~ gender + age + yearsmarried + children + religiousness + education + occupation + rating, data = Affairs) cmtest(z, test = "normality") cmtest(z, test = "skewness", OPG = TRUE) cmtest(z, test = "kurtosis", OPG = TRUE) cmtest(z, test = "reset", powers = 2, OPG = TRUE) cmtest(z, test = "reset", powers = 3, OPG = TRUE) cmtest(z, test = "heterosc", OPG = TRUE, heter_cov = ~ gender)
# replication of Wells (2003) and Pagan and Vella (1989) using Fair's data library("AER") data("Affairs", package = "AER") z <- tobit(affairs ~ gender + age + yearsmarried + children + religiousness + education + occupation + rating, data = Affairs) cmtest(z, test = "normality") cmtest(z, test = "skewness", OPG = TRUE) cmtest(z, test = "kurtosis", OPG = TRUE) cmtest(z, test = "reset", powers = 2, OPG = TRUE) cmtest(z, test = "reset", powers = 3, OPG = TRUE) cmtest(z, test = "heterosc", OPG = TRUE, heter_cov = ~ gender)