Learn R Programming

bWGR (version 1.3.1)

BMEN: Bagging Metropolis Elastic Net (BMEN)

Description

Univariate model regularized via elastic net to find breeding values through regression with resampling techniques.

Usage

BagMEN(y,X,it=500,bi=100,bag=0.5,alpha=0.5,wpe=1)

Arguments

y
Numeric vector of observations ($n$) describing the trait to be analyzed. NA is allowed.
X
Numeric matrix containing the genotypic data. A matrix with $n$ rows of observations and ($m$) columns of molecular markers.
it
Integer. Number of iterations or samples to be generated.
bi
Integer. Burn-in, the number of iterations or samples to be discarted.
bag
Proportion of data used to bag MCMC.
alpha
Value between 0 and 1. An elastic net with alpha = 1 is a ridge regression, and alpha = 0 is a LASSO. Proposed values of alphas for the Manhattan algorithm are sampled from a beta distribution with expectation provided by this argument.
wpe
Weight assigned for out-of-bag sum of squared prediction error. Important for the update of alpha via Metropolis algorithm.

Value

The function BagMEN returns a list with regression coefficient ($coef$), regularization parameters alpha ($alp$) and lambda ($lmb$), the intercept ($b0$), the out-of-bag mean square prediction error ($MSPEoob$) and the fitted value ($hat$).

Details

The model for the whole-genome regression is as follows:

$y = mu + Xb + e$,

where $y$ is the response variable, $mu$ is the intercept, $X$ is the genotypic matrix, $b$ is the effect of an allele substitution and $e$ is the residual term.

This function minimizes the loss:

$l = (e'e)+(w*f'f)+L(A*(b'b)+(1-A)*sum(abs(b))$

Thus minimizing both goodness-of-fit error (e) and out-of-bag prediction error (f), where f can be present (w=1) or absent (w=0). Regression coefficients are updated via coordinate descent. L is computed using variances (VarE/VarB) and A is found through a Metropolis algorithm.

Examples

Run this code

data(tpod)
gen = gen[,seq(1,376,5)]

# Fit BagMEN 
fit = BagMEN(y,gen)
cor(y,fit$hat)

Run the code above in your browser using DataLab