get_surface | R Documentation |
Get Two-Dimensional Control Net and Surface from n-dimensional Control Nets
get_surface(x, margin = 1:2, at, n = 100)
x |
a |
margin |
an integer identifying the marginal of the control net to slice
along. Only used when working |
at |
point value for marginals not defined in the |
n |
the length of sequence to use for interpolating the spline function. |
a list with two elements
the control net
a data.frame with three columns to define the surface
get_spline
## Extract the control net and surface from a cpr_cn object.
a_cn <- cn(log10(pdg) ~ btensor(list(day, age, ttm)
, df = list(15, 3, 5)
, bknots = list(c(-1, 1), c(45, 53), c(-9, -1))
, order = list(3, 2, 3))
, data = spdg)
cn_and_surface <- get_surface(a_cn, n = 50)
str(cn_and_surface, max.level = 2)
old_par <- par()
par(mfrow = c(1, 2))
with(cn_and_surface$cn,
plot3D::persp3D(unique(Var1),
unique(Var2),
matrix(z,
nrow = length(unique(Var1)),
ncol = length(unique(Var2))),
main = "Control Net")
)
with(cn_and_surface$surface,
plot3D::persp3D(unique(Var1),
unique(Var2),
matrix(z,
nrow = length(unique(Var1)),
ncol = length(unique(Var2))),
main = "Surface")
)
par(old_par)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.