psNormal_Deriv: Derivative for a P-spline fit of scattered (normal) data.

psNormal_DerivR Documentation

Derivative for a P-spline fit of scattered (normal) data.

Description

psNormal_Deriv provides the derivative P-spline fit along x.

Usage

psNormal_Deriv(
  x,
  y,
  xl = min(x),
  xr = max(x),
  nseg = 10,
  bdeg = 3,
  pord = 2,
  lambda = 1,
  wts = rep(1, length(y)),
  xgrid = x
)

Arguments

x

the vector for the continuous regressor of length(y) and the abcissae of fit.

y

the response vector, usually continuous data.

xl

the number for the min along x (default is min(x)) .

xr

the number for the max along x (default is max(x)).

nseg

the number of evenly spaced segments between xl and xr.

bdeg

the number of the degree of the basis, usually 1, 2, or 3 (defalult).

pord

the number of the order of the difference penalty, usually 1, 2 (defalult), or 3.

lambda

the positive tuning parameter (default 1).

wts

the vector of weights, default is 1; 0/1 allowed.

xgrid

a scalar or a vector that gives the x locations for prediction, useful for plotting. If a scalar (default 100) is used then a uniform grid of this size along (xl, xr).

Details

This is also a support function needed for sim_psr and sim_vcpsr. SISR (Eilers, Li, Marx, 2009).

Value

coef

a vector of length(nsegs + bdeg) of estimated P-spline coefficients.

B

The B-spline matrix of dimensions m by length(coef).

fit

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

pred

a vector of length(xgrid) of (future) predictions.

d_coef

a vector of length(nsegs + bdeg - 1) of differenced (derivative) estimated P-spline coefficients.

B_d

The first derivative B-spline matrix of dimensions m by lengh(d_coef).

d_fit

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

d_pred

a vector of length lenght(xgrid) of partial derivative (future) predictions.

xl

the number for the min along x (default is min(x)).

xr

the number for the max along x (default is max(x)).

nseg

the number of evenly spaced segments between xl and xr.

bdeg

the number of the degree of the basis, usually 1, 2, or 3 (default).

pord

the number of the order of the difference penalty, usually 1, 2 (default), or 3.

lambda

the positive tuning parameter (default 1).

Author(s)

Paul Eilers and 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., B. Li, B.D. Marx (2009). Multivariate calibration with single-index signal regression, Chemometrics and Intellegent Laboratory Systems, 96(2), 196-202.

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

See Also

sim_psr sim_vcpsr


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

Related to psNormal_Deriv in JOPS...