powered by
Estimates the trace of the (unknown) hat-matrix by stochastic estimation in a matrix-free manner.
estimate_trace(m, q, lambda, X, pen_type = "curve", l = NULL, n_random = 5)
Vector of non-negative integers. Each entry gives the number of inner knots for the respective covariate.
Vector of positive integers. Each entry gives the spline degree for the respective covariate.
Positive number as weight for the penalty term.
Matrix containing the covariates as columns and the units as rows.
Utilized penalization method. Either "curve" for the curvature penalty or "diff" for the difference penalty. Defaults to "curve".
"curve"
"diff"
Positive integer vector of length P indicating for the penalty degree. Only required if pen_type = "diff".
P
pen_type = "diff"
Positive integer for the number of random vectors in the trace estimate. Defaults to 5.
5
An estimate of the trace of the hat-matrix.
# NOT RUN { 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) # }
Run the code above in your browser using DataLab