Skip to contents

Fits an MCP-penalized linear regression model via `ncvreg::cv.ncvreg` and returns the coefficient vector at `lambda.min`.

Usage

mcpWeights(X, y, nfolds = 5, ...)

Arguments

X

A numeric matrix of predictors.

y

A numeric response vector.

nfolds

Number of cross-validation folds. Default is 5.

...

Additional arguments passed through to `ncvreg::cv.ncvreg`.

Value

A numeric vector of length `ncol(X)` of variant weights.

Examples

data(eqtlRegionExample)
X <- eqtlRegionExample$X[, 1:30]
y <- eqtlRegionExample$yRes
mcpWeights(X, y)
#>              [,1]
#>  [1,] -0.03979913
#>  [2,]  0.00000000
#>  [3,]  0.00000000
#>  [4,]  0.00000000
#>  [5,]  0.00000000
#>  [6,]  0.00000000
#>  [7,]  0.00000000
#>  [8,]  0.00000000
#>  [9,]  0.00000000
#> [10,]  0.00000000
#> [11,]  0.00000000
#> [12,] -0.01590482
#> [13,]  0.00000000
#> [14,]  0.00000000
#> [15,]  0.00000000
#> [16,]  0.00000000
#> [17,]  0.00000000
#> [18,]  0.00000000
#> [19,]  0.00000000
#> [20,]  0.00000000
#> [21,]  0.00000000
#> [22,]  0.00000000
#> [23,]  0.00000000
#> [24,]  0.00000000
#> [25,]  0.00000000
#> [26,]  0.00000000
#> [27,] -0.11775615
#> [28,]  0.00000000
#> [29,]  0.08101962
#> [30,]  0.00000000