Significance and Specification
npsigtest, npcmstest, significance test, model specification test, np tests
This page covers two regression tests:
npsigtestfor nonparametric regression significance testing,npcmstestfor consistent model specification testing.
If you want minimal downloadable scripts for the two main routes on this page, start with:
Current releases use B consistently for public bootstrap counts. npsigtest() also chooses pivotal statistics for continuous predictors and unstandardized statistics for categorical predictors by default; an explicit pivot choice still overrides that automatic policy.
Significance testing: npsigtest
For a fitted regression \(g(x)=E(Y\mid X=x)\), npsigtest() tests whether a selected predictor contributes to \(g(x)\).
## Fit a local-linear regression before calling the nonparametric significance test
library(np)
data(cps71, package = "np")
fit <- npreg(logwage ~ age,
regtype = "ll",
bwmethod = "cv.aic",
gradients = TRUE,
data = cps71)
npsigtest(fit, B = 99)The test retains the nonparametric regression specification rather than replacing it with a linear model.
Model specification testing: npcmstest
npcmstest() tests a parametric conditional-mean specification against a consistent nonparametric alternative.
The wage1 example starts with a simple linear specification and then asks whether that specification is too restrictive.
## Compare a simple linear model to a nonparametric alternative
library(np)
data(wage1, package = "np")
model_ols <- lm(lwage ~ female + married + educ + exper + tenure,
x = TRUE,
y = TRUE,
data = wage1)
X <- data.frame(female = wage1$female,
married = wage1$married,
educ = wage1$educ,
exper = wage1$exper,
tenure = wage1$tenure)
test_out <- npcmstest(model = model_ols,
xdat = X,
ydat = wage1$lwage,
B = 99,
nmulti = 1)
summary(test_out)Practical warning
These tests can be computationally demanding because they may involve both bandwidth selection and bootstrap procedures.
Practical advice:
- begin with a small problem when exploring a specification,
- budget separately for estimation and testing,
- preserve the default search tolerances unless a deliberate exploratory run requires otherwise.
When should I use these?
| Question | Function |
|---|---|
| Is a regressor significant in a nonparametric regression setting? | npsigtest |
| Does a parametric regression model look misspecified against a nonparametric alternative? | npcmstest |
How do these fit with the rest of the site?
- Start with Kernel Primer if you are new to the main estimation workflow.
- See Entropy and Testing for the entropy-based test family.
- See Plotting and Intervals if you want uncertainty summaries and graphical output.