estimate_trace {mgss} | R Documentation |
Trace estimation of the hat matrix.
Description
Estimates the trace of the (unknown) hat-matrix by stochastic estimation in a matrix-free manner.
Usage
estimate_trace(m, q, lambda, X, pen_type = "curve", l = NULL, n_random = 5)
Arguments
m |
Vector of non-negative integers. Each entry gives the number of inner knots for the respective covariate. |
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. |
pen_type |
Utilized penalization method. Either |
l |
Positive integer vector of length |
n_random |
Positive integer for the number of random vectors in the trace estimate. Defaults to |
Value
An estimate of the trace of the hat-matrix.
Examples
data <- generate_test_data(100, 2)
X <- data$X_train
estimate_trace(m = c(7,7), q = c(2,2), lambda = 0.1, X = X)