Regression Spline Significance Test with Mixed Data Types
crssigtest.Rdcrssigtest implements a consistent test of significance of
an explanatory variable in a nonparametric regression setting that is
analogous to a simple \(t\)-test in a parametric regression
setting. The test is based on Ma and Racine (2011).
Usage
crssigtest(model = NULL,
index = NULL,
boot = TRUE,
boot.num = 399,
boot.type = c("residual","reorder"),
random.seed = 42)Arguments
Data, Model Inputs And Formula Interface
These arguments identify the fitted model and tested indices.
- index
a vector of indices for the columns of
model$xzfor which the test of significance is to be conducted. Defaults to (1,2,...,\(p\)) where \(p\) is the number of columns inmodel$xz.- model
a
crsmodel object.
- boot
a logical value (default
TRUE) indicating whether to compute the bootstrap P-value or simply return the asymptotic P-value.- boot.num
an integer value specifying the number of bootstrap replications to use. Defaults to
399.- boot.type
whether to conduct ‘residual’ bootstrapping (iid) or permute (reorder) in place the predictor being tested when imposing the null.
- random.seed
an integer used to seed R's random number generator. This is to ensure replicability. Defaults to 42.
Value
crssigtest returns an object of type
sigtest. summary supports sigtest
objects. It has the following components:
- index
the vector of indices input
- P
the vector of bootstrap P-values for each statistic in
F- P.asy
the vector of asymptotic P-values for each statistic in index
- F
the vector of pseudo F-statistics
F- F.boot
the matrix of bootstrapped pseudo F-statistics generated under the null (one column for each statistic in
F)- df1
the vector of numerator degrees of freedom for each statistic in
F(based on the smoother matrix)- df2
the vector of denominator degrees of freedom for each statistic in
F(based on the smoother matrix)- rss
the vector of restricted sums of squared residuals for each statistic in
F- uss
the vector of unrestricted sums of squared residuals for each statistic in
F- boot.num
the number of bootstrap replications
- boot.type
the
boot.type- xnames
the names of the variables in
model$xz
References
Li, Q. and J.S. Racine (2007), Nonparametric Econometrics: Theory and Practice, Princeton University Press.
Ma, S. and J.S. Racine, (2011), “Inference for Regression Splines with Categorical and Continuous Predictors,” Working Paper.
Author
Jeffrey S. Racine racinej@mcmaster.ca
Usage Issues
This function should be considered to be in ‘beta status’ until further notice.
Caution: bootstrap methods are, by their nature, computationally
intensive. This can be frustrating for users possessing large
datasets. For exploratory purposes, you may wish to override the
default number of bootstrap replications, say, setting them to
boot.num=99.
Examples
if (FALSE) { # \dontrun{
options(crs.messages=FALSE)
set.seed(42)
n <- 1000
z <- rbinom(n,1,.5)
x1 <- rnorm(n)
x2 <- runif(n,-2,2)
z <- factor(z)
## z is irrelevant
y <- x1 + x2 + rnorm(n)
model <- crs(y~x1+x2+z,complexity="degree",segments=c(1,1))
summary(model)
model.sigtest <- crssigtest(model)
summary(model.sigtest)
} # }