DCSmooth provides functions for fast nonparametric estimation of the trend surface of a functional or spatial model. Regression types included are kernel regression and local polynomial regression. An automatic bandwidth selector is included.
You can install the released version of DCSmooth from CRAN with:
install.packages("DCSmooth")
This basic example shows the two-dimensional estimation of a single
gaussian peak. The observations y(x, t) should be stored in a
numeric matrix, say Y
, ordered by x (rows) and t (columns). Our
example data is temp.yuma
. Simple estimation of the mean surface of
y can now be done using the dcs()
command of the package:
library(DCSmooth)
Y = temp.yuma
Y_dcs = dcs(Y)
This procedure uses some default values which can be tuned if necessary
(see below). The estimated values of the smoothed surface ŷ(x, t)
are stored in Y_dcs$M
, the residuals in Y_dcs$R
.
Surface plots are produced via the surface.dcs()
command
surface.dcs(Y_dcs)
Example of smoothed surface:
surface.dcs(Y_dcs, plot_choice = 2)
#> PhantomJS not found. You can install it with webshot::install_phantomjs(). If it is installed, please make sure the phantomjs executable can be found via the PATH variable.