| copper | R Documentation |
Copper grade at sampling points with their X, Y and Z coordinates within a designated area. Used in the overview article to fit a semiparametric model with a smooth in Z and a thin-plate spline in X and Y.
data(copper)
data(copperKnots)
A data frame with 439 rows and 4 columns:
X coordinate of the sampling point.
Y coordinate of the sampling point.
Z coordinate of the sampling point.
copper grade (positive; modelled on the log scale below).
copperKnots: the 20 knots (columns xcoord, ycoord) of M. P. Wand's thin-plate spline
fit of these data (a geoadditive model fitted by lme()), which semireg reproduces.
data(copper)
data(copperKnots)
# M. P. Wand's geoadditive model: a thin-plate surface over the plane with the given knots,
# and an O'Sullivan spline in depth (their linear terms are added to the fixed effects)
mod <- semireg(grade ~ s(xcoord, ycoord, bs = "ztps", xt = list(knots = as.matrix(copperKnots))) +
s(zcoord, bs = "os", xt = list(knots = seq(80, 120, by = 5))), data = copper)
anova(mod) # fixed effects (Kenward-Roger) and a test of each smooth term
semipred(mod, covariate = c("xcoord", "ycoord"))$plt
# on the log scale, with the pairwise interactions of the coordinates
mod2 <- semireg(log(grade) ~ s(zcoord, bs = "os") + s(xcoord, ycoord, bs = "ztps", k = 6) +
xcoord:ycoord + xcoord:zcoord + ycoord:zcoord, data = copper)
semipred(mod2, covariate = "zcoord", trans = exp)$plt
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.