ps2DNormal | R Documentation |
ps2DNormal is used to smooth scattered (normal) data, with aniosotripic penalization of tensor product P-splines.
ps2DNormal(
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 = expand.grid(Data[, 1], Data[, 2])
)
Data |
a matrix of 3 columns |
Pars |
a matrix of 2 rows, where the first and second row
sets the P-spline paramters for |
XYpred |
a matrix with two columns |
Support functions needed: pspline_fitter
, bbase
, and pspline_2dchecker
.
coef |
a vector of length |
fit |
a vector of |
pred |
a vector of length |
Pars |
the design and tuning parameters (see arguments above). |
cv |
leave-one-out standard error of prediction or root average PRESS. |
h |
"hat" diagonals of tensor P-spline fit. |
B |
tensor product B-spline basis used for fitting. |
Paul Eilers and Brian Marx
Eilers, P.H.C. and Marx, B.D. (2021). Practical Smoothing, The Joys of P-splines. Cambridge University Press.
Eilers, P.H.C., Marx, B.D., and Durban, M. (2015). Twenty years of P-splines, SORT, 39(2): 149-186.
ps2DGLM
library(SemiPar)
library(fields)
library(spam)
library(JOPS)
# Get the data
data(ethanol)
x <- ethanol$C
y <- ethanol$E
z <- ethanol$NOx
# Set parameters for domain
xlo <- 7
xhi <- 19
ylo <- 0.5
yhi <- 1.25
# Set P-spline parameters, fit and compute surface
xpars <- c(xlo, xhi, 10, 3, 3, 1)
ypars <- c(ylo, yhi, 10, 3, 3, 1)
Pars1 <- rbind(xpars, ypars)
fit <- ps2DNormal(cbind(x, y, z), Pars = Pars1)
plot(fit, xlab = "C", ylab = "E")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.