Description Usage Arguments Value References Examples
Fits a smooth spline to a set of given observations using penalized splines with curvature penalty and multiple covariates. The underlying linear system is solved with a matrix-free preconditioned conjugated gradient method using a geometric multigrid method as preconditioner.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
G |
Positive integer greater than one for the maximum number of grids. |
q |
Vector of positive integers. Each entry gives the spline degree for the respective covariate. |
lambda |
Positive number as weight for the penalty term. |
X |
Matrix containing the covariates as columns and the units as rows. |
y |
Vector of length |
w |
Damping factor of the Jacobi smoother. Defaults to |
nu |
Two-dimensional vector of non-negative integers. Gives the number of pre- and post-smoothing steps in the multigrid algorithm. |
alpha_start |
Vector of length |
K_max |
Positive integer as upper bound for the number of MGCG-iterations. Defaults to |
tolerance |
Positive number as error tolerance for the stopping criterion of the MGCG-method. Defaults to |
print_error |
Logical, indicating if the iteration error should be printed or not. |
coarse_grid_solver |
Utilized coarse grid solver. Either |
Returns a list containing the input m = 2^G-1
, q
, and Omega
. Further gives the fitted spline coefficients alpha
, the fitted values fitted_values
, the residuals residuals
, the root mean squared error rmse
and the R-squared value R_squared
.
Siebenborn, M. and Wagner, J. (2019) A Multigrid Preconditioner for Tensor Product Spline Smoothing. arXiv:1901.00654
1 2 3 4 | data <- generate_test_data(100, 2)
X <- data$X_train
y <- data$y_train
MGCG_smooth(G = 3, q = c(3,3), lambda = 0.1, w = 0.8, X = X, y = y)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.