cv.wtf1: Monotone Degree-One Weighted Trend Filter Cross-Validation

View source: R/wtf1.R

cv.wtf1R Documentation

Monotone Degree-One Weighted Trend Filter Cross-Validation

Description

Use a fixed set of knots and a random partition of the data to cross-validate the risk estimate for a provided list of tau values. If 'nfolds = length(x)' leave-one-out cross-validation is used. If 'fit.best = TRUE' (default) then a final model is fit using all of the data and best value of tau. A seed is available to set for reproducible partitions.

Usage

cv.wtf1(x, s, tau.options, nfolds = 5, seed = NULL, fit.best = TRUE, ...)

Arguments

x

Gaussian sequence

s

standard deviation

tau.options

a vector of candidate values for TV(d')

nfolds

number of cross-validation folds

seed

random seed used for reproducible folds

fit.best

boolean (default TRUE) whether to fit all of 'x' with the best candidate value of TV(d')

...

additional parameters passed to wtf1() such as backend and knots

Value

theta_hat

estimated values of means of Gaussian sequence

x

original Gaussian sequence

s

known standard deviation

SURE

value of minimum risk estimate

tau

the user specified bound on TV(d')

TV1

the value of TV(d') for minimizer

intercept

intercept of fitted estimator

slopes

slopes of fitted estimator

knots

location of knots

backend

which version of wtf1 was used

solver

solver used by CVXR

...

additional inputed parameters

cv.risks

data.frame containing cross-validation parameters and risks

nfold

number of folds for cross-validation

seed

seed for reproducible fold partitions

Examples

# basic usage
set.seed(1)
theta = rnorm(250)
x = theta + rnorm(250)
res = cv.wtf1(x, s = 1, tau.options = 1:2, knots = -2:2)
mean((theta - res$theta_hat)^2)

barbehenna/coleReg documentation built on May 8, 2022, 12:05 a.m.