Description Usage Arguments Details Value Author(s) References See Also Examples
The generic S3 method for predictions for objects of class HierBasis
.
1 2 3 |
object |
A fitted object of class ' |
new.x |
An optional vector of x values we wish to fit the fitted functions at. This should be within the range of the training data. |
interpolate |
A logical indicator of if we wish to use linear interpolation for estimation of fitted values. This becomes useful for high dof when the estimation of betas on the original scale becomes unstable. |
... |
Not used. Other arguments for predict function. |
This function returns a matrix of predicted values at the specified
values of x given by new.x
. Each column corresponds to a lambda value
used for fitting the original model.
If new.x == NULL
then this function simply returns
the fitted values of the estimated function at the original x values used for
model fitting. The predicted values are presented for each lambda values.
The function also has an option of making predictions
via linear interpolation. If TRUE
, a predicted value is equal to the
fitted values if new.x
is an x value used for model fitting. For a
value between two x values used for model fitting, this simply returns the
value of a linear interpolation of the two fitted values.
fitted.values |
A matrix with |
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)
predict.poly <- predict(poly.fit, new.x = (1:80)/80)
plot(x, y1dat, type = "p", ylab = "y1")
lines(x, y1, lwd = 2)
lines((1:80)/80, predict.poly[,30], col = "red", lwd = 2)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.