crssigtest function

Regression Spline Significance Test with Mixed Data Types

Regression Spline Significance Test with Mixed Data Types

crssigtest implements a consistent test of significance of an explanatory variable in a nonparametric regression setting that is analogous to a simple tt-test in a parametric regression setting. The test is based on Ma and Racine (2011).

crssigtest(model = NULL, index = NULL, boot.num = 399, boot.type = c("residual","reorder"), random.seed = 42, boot = TRUE)

Arguments

  • model: a crs model object.
  • index: a vector of indices for the columns of model$xz for which the test of significance is to be conducted. Defaults to (1,2,...,pp) where pp is the number of columns in model$xz.
  • 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.
  • boot: a logical value (default TRUE) indicating whether to compute the bootstrap P-value or simply return the asymptotic P-value.

Returns

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 ContinuousPredictors, Working Paper.

Author(s)

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

## Not run: 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) ## End(Not run)
  • Maintainer: Jeffrey S. Racine
  • License: GPL (>= 3)
  • Last published: 2024-09-29