enet_loss: The elastic net loss function

Description Usage Arguments Details Value

View source: R/FGSPCAUtils.R

Description

The elastic net loss function (not the standard version)

Usage

1
enet_loss(x, y, beta, lambda1, lambda2, verbose = FALSE)

Arguments

x

the data matrix X_{n\times p}

y

the response vector Y_{n \times 1}

beta

β the estimation of β

lambda1

the λ_1 in the loss function

lambda2

the λ_2 in the loss function

verbose

whether to return a list, FALSE (default)

Details

The standard version of the elastic net problem is defined as follows,

1/(2n) \| Y-Xβ\|_2^2 + λ (α \|β\|_1 + (1-α )/2\|β\|_2^2) .

The objective function of the elastic net we use in this function is defined as

1/(2n) \| Y-Xβ\|_2^2 + λ_1\|β\|_1 + λ_2\|β\|_2^2 .

It is not the standard version of the elastic net problem.

Value

the value of the loss function or a list c(loss, pen, obj)


ipapercodes/FGSPCA documentation built on Dec. 20, 2021, 7:58 p.m.