| nppltest | R Documentation |
Tests whether the conditional mean has the form
E(Y\mid X,Z)=X^T\beta+g(Z) against an unrestricted conditional
mean. A rejection can indicate curvature in the linear regressors or an
interaction between the linear and nuisance regressors.
nppltest(object, bw.method = c("sun", "cv", "object"),
boot.method = c("wild-rademacher", "wild"), B = 399L,
random.seed = 42L, projection.scale = c("original", "standardized"),
..., boot.correction = c("none", "cv-pilot", "pilot-hc2", "cv-raw"),
integration = c("sobol", "exact"), directions = 2048L)
object |
A fitted |
bw.method |
|
boot.method |
Wild multiplier law. |
B |
Integer number of draws, at least 9. Ties count as exceedances. |
random.seed |
An integer for temporary seeding. The caller's RNG
state is restored on return or error. |
projection.scale |
Use original predictor units or standardize numeric
coordinates and ordered-factor scores for the projection geometry.
In the null fit, linear factors use the slope coding of
|
... |
Named controls for |
boot.correction |
|
integration |
The default, |
directions |
Positive integer number of Sobol directions. The default
is 2,048. Smaller counts reduce projection time. Larger counts extend
the same sequence. Omit this argument with |
Sun, Chen, Liang and Ruppert (2021) integrate a squared marked residual process over directions of the joint predictors and empirical thresholds. In Sobol mode, the package shifts each coordinate of the Sobol points modulo one, applies the standard normal quantile function and normalizes each vector to unit length. The fixed shift was generated independently of the data and bootstrap (Mersenne–Twister seed 514907). The observed and bootstrap statistics use identical directions and empirical thresholds. Tied projected values enter the residual sum together. Unordered factors use orthonormal contrasts scaled to unit distance between levels. Sobol integration supports up to 1,111 projection coordinates, counting one per numeric or ordered predictor and one fewer than the number of observed levels per unordered factor. Exact integration uses the original angular formula. Kernel smoothing estimates the null conditional means. A bootstrap response is its chosen center plus a residual amplitude times an independent multiplier. Each draw is refitted with the test bandwidths. The test forms the training operator from the conditional smoother weights and a single factorization of the residualized linear covariates. Factor nuisance variables retain the categorical kernel conventions of the fitted regression.
For a single continuous nuisance variable the default Gaussian bandwidth
is 1.06\min(s,0.75\,IQR)n^{-1/3}. For q=2,3 the
test uses coordinate-specific scales and exponent -3/(q+8).
With factors, the default fits within observed joint cells. An all-factor
nuisance uses cell means. Zero scales, unidentified local designs, absent
residual variation and undefined requested HC2 adjustments produce errors.
For q\ge4 the proposed local-linear Sun rule is unavailable.
The published theory assumes a scalar continuous nuisance. The
multivariate rate, factor encoding, matching and pilot calibrations are
research extensions. The sampling unit is an independent observation.
In the independent twelve-cell study the original bootstrap rejected
15.5 percent of true nulls in the four-slope, binary-factor cell at
n=120. CV-pilot HC2 and raw CV/Mammen were conservative across
those designs; nominal power also differed. The test returns no automatic
choice based on dimension or a preliminary test.
Finite-direction integration is a computational approximation to the
published statistic. In two mixed continuous/binary designs at
n=240 and 800, with 1,000 samples per design and size and
399 draws, the largest observed differences from exact integration at
2,048 directions were 0.4 percentage points for size and 0.5 for power
against curvature or interactions, across fixed and freshly shifted
sequences. All paired 95 percent intervals were within two percentage
points. Exact rejection rates at nominal five percent were 8.1 to 12.7
percent on these designs. Other designs can give different calibration.
Sobol integration sorts the projected observations and scores the
bootstrap residuals in blocks. With a fixed number of directions and
draws, sorting for one block takes order n\log n. The null fit
still stores a dense training operator and reuses it across bootstrap
responses. Exact angular integration stores an additional dense matrix
and takes cubic time at fixed predictor dimension. The CV-pilot HC2 option also computes the
squared row norms of the separate pilot residual operator.
total.time gives wall-clock seconds for this test call, including
preparation and bootstrap calibration. The summary reports this time.
With getOption("show.signif.stars") enabled, the printed bootstrap
p-value carries the significance codes used by npsigtest.
Each symbol requires a p-value strictly below its threshold. A zero is displayed as ‘0 (0 of B)’, with the actual number of draws.
A pltest list. statistic is the observed quadratic form.
P is the proportion of bootstrap statistics greater than or
equal to the observed statistic.
exceedances, bootstrap and critical.values
retain the count, bootstrap statistics in replication order and empirical 90, 95 and 99 percent
quantiles. bw.method, bws, bandwidths,
boot.method, boot.correction and pilot identify the
calibration. n, continuous.z, cell.counts,
projection.scale, integration, directions (NULL for exact integration),
boot.num and random.seed
describe the sample and computation. call and model.call
retain the test and input model calls. x.names, z.names and
factor.levels identify the predictors and nuisance factor levels.
rank.counts is NULL for serial execution.
print and summary return the object invisibly.
Section 6.1 of Sun et al. directly compares Fan and Li's kernel U-statistic, Zhu and Ng's residual empirical process, and Xia's adaptive projection test. Sun et al. report the highest empirical power in their two-regressor interaction design. With 20 linear regressors, two peer statistics frequently degenerated and Xia's had low power. These are comparisons under the paper's designs and calibrations. They do not establish a mixed-data ranking.
Sun, Z., Chen, F., Liang, H. and Ruppert, D. (2021). A projection-based consistent test incorporating dimension-reduction in partially linear models. Statistica Sinica, 31, 1489–1508. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.5705/ss.202019.0238")}.
Fan, Y. and Li, Q. (1996). Consistent model specification tests: omitted variables and semiparametric functional forms. Econometrica, 64, 865–890. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.2307/2171848")}.
Zhu, L.-X. and Ng, K. W. (2003). Checking the adequacy of a partial linear model. Statistica Sinica, 13, 763–781.
Xia, Y. (2009). Model checking in regression via dimension reduction. Biometrika, 96, 133–148. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1093/biomet/asn074")}.
Mammen, E. (1993). Bootstrap and wild bootstrap for high dimensional linear models. Annals of Statistics, 21, 255–285. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1214/aos/1176349025")}.
npplreg, npplregbw, npcmstest
## Not run:
# set.seed() controls the simulated data. The test's random.seed argument
# controls the bootstrap draws and defaults to 42 in both calls below.
set.seed(42)
n <- 120L
d <- data.frame(x1 = rnorm(n), x2 = rnorm(n), z = runif(n, -1, 1))
noise <- with(d, (0.45 + 0.30*z^2)*rnorm(n))
# Under the null, x1 and x2 have constant slopes and z enters smoothly.
d$y0 <- with(d, 0.8*x1 - 0.6*x2 + sin(pi*z) + noise)
bw0 <- npplregbw(y0 ~ x1 + x2 | z, data = d, regtype = "ll")
fit0 <- npplreg(bw0)
summary(nppltest(fit0))
# P Value: 0.4862155 (194 of 399) at seed 42. Do not reject partial linearity at level 0.05.
# For the alternative, keep the predictors and noise and add curvature in x1.
# The nuisance function of z cannot absorb this term.
d$y1 <- with(d, y0 + 1.5*(x1^2 - 1))
bw1 <- npplregbw(y1 ~ x1 + x2 | z, data = d, regtype = "ll")
summary(nppltest(bw1))
# P Value: 0 (0 of 399) at seed 42. Reject partial linearity at level 0.05.
# To change the integration, use nppltest(fit0, directions = 512L)
# or nppltest(fit0, integration = "exact").
# With another data seed, even a true null can be rejected, and a sample
# drawn under the alternative can fail to reject. With the data held fixed,
# changing random.seed can change the p-value through bootstrap variation.
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.