kre_polysph | R Documentation |
Computes a local constant (Nadaraya–Watson) or local linear estimator with polyspherical response and scalar predictor.
kre_polysph(x, X, Y, d, h, p = 0)
x |
a vector of size |
X |
a vector of size |
Y |
a matrix of size |
d |
vector of size |
h |
a positive scalar giving the bandwidth. |
p |
degree of local fit, either |
A vector of size nx
with the estimated regression curve
evaluated at x
.
x_grid <- seq(-0.25, 1.25, l = 200)
n <- 50
X <- seq(0, 1, l = n)
Y <- r_path_s2r(n = n, r = 1, sigma = 0.1, spiral = TRUE)[, , 1]
h0 <- bw_cv_kre_polysph(X = X, Y = Y, d = 2, p = 0, plot_cv = FALSE)$h_1se
sc3 <- scatterplot3d::scatterplot3d(Y, pch = 16, xlim = c(-1, 1),
ylim = c(-1, 1), zlim = c(-1, 1),
xlab = "", ylab = "", zlab = "")
sc3$points3d(kre_polysph(x = x_grid, X = X, Y = Y, d = 2, h = h0, p = 0),
pch = 16, type = "l", col = 2, lwd = 2)
sc3$points3d(kre_polysph(x = x_grid, X = X, Y = Y, d = 2, h = h0, p = 1),
pch = 16, type = "l", col = 3, lwd = 2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.