estimate_trace: Trace estimation of the hat matrix.

Description Usage Arguments Value Examples

View source: R/mgss_main.R

Description

Estimates the trace of the (unknown) hat-matrix by stochastic estimation in a matrix-free manner.

Usage

1
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 "curve" for the curvature penalty or "diff" for the difference penalty. Defaults to "curve".

l

Positive integer vector of length P indicating for the penalty degree. Only required if pen_type = "diff".

n_random

Positive integer for the number of random vectors in the trace estimate. Defaults to 5.

Value

An estimate of the trace of the hat-matrix.

Examples

1
2
3
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)

mgss documentation built on May 10, 2021, 9:07 a.m.