crssigtest 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).
crssigtest(model = NULL,
index = NULL,
boot = TRUE,
boot.num = 399,
boot.type = c("residual","reorder"),
random.seed = 42)crssigtest returns an object of type
sigtest. summary supports sigtest
objects. It has the following components:
the vector of indices input
the vector of bootstrap P-values for each statistic in F
the vector of asymptotic P-values for each statistic in index
the vector of pseudo F-statistics F
the matrix of bootstrapped pseudo F-statistics
generated under the null (one column for each statistic in F)
the vector of numerator degrees of freedom for each
statistic in F (based on the smoother matrix)
the vector of denominator degrees of freedom for each
statistic in F (based on the smoother matrix)
the vector of restricted sums of squared residuals for
each statistic in F
the vector of unrestricted sums of squared residuals for
each statistic in F
the number of bootstrap replications
the boot.type
the names of the variables in model$xz
These arguments identify the fitted model and tested indices.
a vector of indices for the columns of model$xz for which the
test of significance is to be conducted. Defaults to (1,2,...,\(p\))
where \(p\) is the number of columns in model$xz.
a crs model object.
These arguments control bootstrap execution and reproducibility settings.
a logical value (default TRUE) indicating whether to compute
the bootstrap P-value or simply return the asymptotic P-value.
an integer value specifying the number of bootstrap replications to
use. Defaults to 399.
whether to conduct ‘residual’ bootstrapping (iid) or permute (reorder) in place the predictor being tested when imposing the null.
an integer used to seed R's random number generator. This is to ensure replicability. Defaults to 42.
Jeffrey S. Racine racinej@mcmaster.ca
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.
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.
if (FALSE) {
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)
}
Run the code above in your browser using DataLab