coef.cv.SplitReg | R Documentation |
Extract coefficients from a cv.SplitReg object.
## S3 method for class 'cv.SplitReg'
coef(object, index = object$index_opt, ...)
object |
Fitted cv.SplitReg object. |
index |
Indices indicating values of lambda_S at which to extract coefficients. Defaults to the optimal value. |
... |
Additional arguments for compatibility. |
A vector of coefficients
cv.SplitReg
library(MASS)
set.seed(1)
beta <- c(rep(5, 5), rep(0, 45))
Sigma <- matrix(0.5, 50, 50)
diag(Sigma) <- 1
x <- mvrnorm(50, mu = rep(0, 50), Sigma = Sigma)
y <- x %*% beta + rnorm(50)
fit <- cv.SplitReg(x, y, num_models=2)
split.coefs <- coef(fit)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.