Description Usage Arguments Value Author(s) References See Also Examples
Extract Degrees of Freedom
1 | GetDoF.HierBasis(object)
|
object |
An object of class |
dof |
A vector of degrees of freedom for the sequence of lambda values used for the fitted HierBasis model. |
Asad Haris (aharis@uw.edu), Ali Shojaie and Noah Simon
Haris, A., Shojaie, A. and Simon, N. (2018). Nonparametric Regression with Adaptive Smoothness via a Convex Hierarchical Penalty. Available on request by authors.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | require(Matrix)
set.seed(1)
# Generate the points x.
n <- 300
x <- (1:300)/300
# A simple quadratic function.
y1 <- 5 * (x - 0.5)^2
y1dat <- y1 + rnorm(n, sd = 0.1)
poly.fit <- HierBasis(x, y1dat)
dof <- GetDoF.HierBasis(poly.fit)
ind <- which.min(abs(dof - 3))[1]
plot(x, y1dat, type = "p", ylab = "y1")
lines(x, y1, lwd = 2)
lines(x, poly.fit$fitted.values[, ind], col = "red", lwd = 2)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.