SpeTest_Stat {SpeTestNP} | R Documentation |
Nonparametric specification test statistic
Description
SpeTest
computes the nonparametric specification test statistic for one of five different tests
Usage
SpeTest_Stat(eq, type="icm", norma="no", ker="normal", knorm="sd",
cch="default", hv="default", nbeta="default", direct="default",
alphan="default")
Arguments
eq |
A fitted model of class |
type |
Test statistic type If If If If If |
norma |
Normalization of the test statistic If If If |
ker |
Kernel function used in the central matrix and for the nonparametric covariance estimator If If If If |
knorm |
Normalization of the kernel function If If |
cch |
Central matrix kernel bandwidth If If If The user may change the bandwidth when |
hv |
If |
nbeta |
If By |
direct |
If If For ex, By |
alphan |
If |
Details
To compute the specification test statistic the only argument needed is a model eq
of class lm
or of class nls
.
But other options can and should be specified: the test statistic type type
, the normalization of the test statistic norma
, the central matrix kernel function ker
and its standardization ker
, the bandwidths cch
and hv
. If the user has knowledge of the tests coined by Lavergne and Patilea he may choose a higher number of betas for the hypersphere (which may significantly increase computational time) and an initial "direction" to the hypersphere for the SICM test (none is given by "default"
) or a starting beta for the PALA test (which is the OLS estimator by "default"
if class(eq) = "nls"
).
The statistic can be normalized with a naive estimator of the conditional covariance of its elements as in Zheng (1996), or with a nonparametric estimator of the conditional covariance of its elements as in in Yin, Geng, Li, Wang (2010).
Value
SpeTest_Stat
returns the nonparametric specification test statistic
Note
The data used to obtain the fitted model eq
should not contain factors, factor variables should be transformed into dummy variables a priori
Requires the packages stats
(already installed and loaded by default in Rstudio), foreach
, parallel
and doParallel
(if parallel computing is used to generate the vector) to be installed
For more information and to be able to use the package to its full potential see the references
Author(s)
Hippolyte Boucher <Hippolyte.Boucher@outlook.com>
Pascal Lavergne <lavergnetse@gmail.com>
References
H.J. Bierens (1982), "Consistent Model Specification Test", Journal of Econometrics, 20 (1), 105-134
J.C. Escanciano (2006), "A Consistent Diagnostic Test for Regression Models using Projections", Economic Theory, 22 (6), 1030-1051
P.L. Gozalo (1997), "Nonparametric Bootstrap Analysis with Applications to Demographic Effects in Demand Functions", Journal of Econometrics, 81 (2), 357-393
P. Lavergne and V. Patilea (2008), "Breaking the Curse of Dimensionality in Nonparametric Testing", Journal of Econometrics, 143 (1), 103-122
P. Lavergne and V. Patilea (2012), "One for All and All for One: Regression Checks with Many Regressors", Journal of Business and Economic Statistics, 30 (1), 41-52
C.F.J. Wu (1986), "Jackknife, bootstrap and other resampling methods in regression analysis (with discussion)", Annals of Statistics, 14 (4), 1261-1350
J. Yin, Z. Geng, R. Li, H. Wang (2010), "Nonparametric covariance model", Statistica Sinica, 20 (1), 469-479
J.X. Zheng (1996), "A Consistent Test of Functional Form via Nonparametric Estimation Techniques", Journal of Econometrics, 75 (2), 263-289
See Also
SpeTest
is the function which performs a specification test and records it along with all its options in an object of class STNP
SpeTest_Dist
generates a vector drawn from the distribution of the test statistic under the null hypothesis using the bootstrap
Examples
n <- 100
k <- 2
x <- matrix(rnorm(n*k),ncol=k)
y<-1+x%*%(1:k)+rnorm(n)
eq<-lm(y~x+0)
SpeTest_Stat(eq=eq,type="icm")
eq<-nls(out~expla1*a+b*expla2+c,start=list(a=0,b=4,c=2),
data=data.frame(out=y,expla1=x[,1],expla2=x[,2]))
SpeTest_Stat(eq=eq,type="icm")