coef.cv.SplitReg: Extract coefficients from a cv.SplitReg object.

Description Usage Arguments Value See Also Examples

View source: R/methods.R

Description

Extract coefficients from a cv.SplitReg object.

Usage

1
2
## S3 method for class 'cv.SplitReg'
coef(object, index = object$index_opt, ...)

Arguments

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.

Value

A vector of coefficients

See Also

cv.SplitReg

Examples

1
2
3
4
5
6
7
8
9
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)

SplitReg documentation built on March 26, 2020, 7:26 p.m.