cvl4acp: Cross-validation for l4acp

Description Usage Arguments Value References See Also Examples

Description

Does k-folds cross-validation for l4acp, produces a plot, and returns a value for lambda

Usage

1
cvl4acp(x, y, q, s=NULL, trim=0.1, nfolds=10)

Arguments

x

Covariates as in l4acp.

y

A dependent variable as in l4acp.

q

A threshold covariate as in l4acp.

s

Input for the sequence of lambdas to be tested. By default, when it is not specificed, it generates 3 lambda sequences of length 100, following the method used in glmnet 3 times from the top, middle, and bottom values of threshold parameter's range. But it is possible that the three lambda sequences are identical. Then after removing duplication, 100 values remain. It is recommended to run without lambda sequence at first time with small nfolds. Important! Remember to check whether it is credible by using plot. See plot.cvl4acp. You can get an idea which lambda sequence to put based on the default one's range.

trim

The percentile for trimming to obtain the range of a threshold parameter as in l4acp.

nfolds

the number of folds for cross-validation. By default it is 10

Value

cvm

The iterated mean of tested mean squared errors for each fold. Each value corresponds to different lambdas. Note that it is written as tested-MSE in the graph from plot.cvl4acp.

mse

The tested MSE for each fold. Its row corresponds to different folds, and column corresponds to different lambdas.

cvsd

The standard error for tested MSE (computed from k number of errors). Each value corresponds to different lambdas.

lambda.seq

The lambda sequence it runned cross validation.

lamda.min

The lambda value that minimizes the cvm.

lambda.1se

The maximal lambda among the values that are smaller than lambda.min+1*cvsd(it depends on lambda)

References

Sokbae Lee, Myung Hwan Seo, and Youngki Shin, (2016) The Lasso for High-Dimensional Regression with a Possible Change Point, Journal of the Royal Statistical Society Series B, Vol 78(1), 193-210

See Also

plot.cvl4acp and l4acp

Examples

1
2
3
4
5
x <- matrix(rnorm(1000), nrow = 50, ncol = 20)
q <- runif(50)
y <- x[,c(1,3)] %*% c(1,1) + x[,c(2,3)] %*% c(-1,1) * (q < 0.5) + 0.5 * rnorm(50)
cvfit <- cvl4acp(x,y,q, nfolds=5)
print(cvfit)

wsggong/toronto documentation built on May 15, 2019, 1:21 p.m.