ps2D_PartialDeriv: Partial derivative two-dimensional smoothing scattered...

ps2D_PartialDerivR Documentation

Partial derivative two-dimensional smoothing scattered (normal) data using P-splines.

Description

ps2D_PartialDeriv provides the partial derivative P-spline surface along x, with aniosotripic penalization of tensor product B-splines.

Usage

ps2D_PartialDeriv(
  Data,
  Pars = rbind(c(min(Data[, 1]), max(Data[, 1]), 10, 3, 1, 2), c(min(Data[, 2]),
    max(Data[, 2]), 10, 3, 1, 2)),
  XYpred = cbind(Data[, 1], Data[, 2])
)

Arguments

Data

a matrix of 3 columns x, y, z of equal length; the response is z.

Pars

a matrix of 2 rows, where the first and second row sets the P-spline paramters for x and y, respectively. Each row consists of: min max nseg bdeg lambda pord. The min and max set the ranges, nseg (default 10) is the number of evenly spaced segments between min and max, bdeg is the degree of the basis (default 3 for cubic), lambda is the (positive) tuning parameter for the penalty (default 1), pord is the number for the order of the difference penalty (default 2).

XYpred

a matrix with two columns (x, y) that give the coordinates of (future) prediction; the default is the data locations.

Details

This is support function for sim_vcpsr.

Value

coef

a vector of length (Pars[1, 3] + Pars[1, 4]) * (Pars[1, 3] + Pars[1, 4]). of (unfolded) estimated P-spline coefficients.

B

the tensor product B-spline matrix of dimensions m by length(coef).

fit

a vector of length(y) of smooth estimated means (at the x, y locations).

pred

a vector of length nrow(XYpred) of (future) predictions.

d_coef

a vector of length (Pars[1, 3] + Pars[1,4] - 1) * (Pars[1,3]+Pars[1,4]). of (unfolded) partial derivative estimated P-spline coefficients.

B_d

the tensor product B-spline matrix of dimensions m by lengh(d_coef), associated with the partial derivative of the tensor basis.

d_fit

a vector of length(y) of partial derivative (along x) of the smooth estimated means (at the x, y locations).

d_pred

a vector of length nrow(XYpred) of partial derivative (future) predictions.

Pars

a matrix of 2 rows, where each the first (second) row sets the P-spline paramters for x (y): min max nseg bdeg lambda pord. See the argument above.

cv

root leave-one-out CV or root average PRESS.

XYpred

a matrix with two columns (x, y) that give the coordinates of (future) prediction; the default is the data locations.

Author(s)

Brian Marx

References

Marx, B. D. (2015). Varying-coefficient single-index signal regression. Chemometrics and Intelligent Laboratory Systems, 143, 111–121.

Eilers, P.H.C. and Marx, B.D. (2021). Practical Smoothing, The Joys of P-splines. Cambridge University Press.


JOPS documentation built on Sept. 8, 2023, 5:42 p.m.

Related to ps2D_PartialDeriv in JOPS...