ebmr | R Documentation |
Fits multiple regression model using a new empirical Bayes variational approach based on generalized ridge regression (GRR).
ebmr( X, y, tol = 1e-08, maxiter = 1000, ebnv_fn = ebnv.exp, compute_mode = FALSE ) ebmr.update( fit, tol = 1e-08, maxiter = 1000, ebnv_fn = ebnv.exp, compute_mode = FALSE, update_residual_variance = TRUE )
X |
An n times p numeric matrix of covariates. |
y |
An n vector of responses. |
tol |
Small real number controlling convergence tolerance;
algorithm stops when elbo changes less than |
maxiter |
Integer indicating maximum number of iterations. |
ebnv_fn |
Function for solving the Empirical Bayes Normal Variances problem. |
compute_mode |
Boolean indicating whether to use the mode (rather than the mean). If used with ebnv_fn = ebnv.exp then this produces the Lasso solution rather than Bayesian Lasso. |
fit |
The previous EBMR fit |
An object of class "ebmr" that contains fit details.
ebmr.update
: Updates a previous EBMR fit, usually using a new prior family
set.seed(100) n = 50 p = 200 X = matrix(rnorm(n*p),nrow=n,ncol=p) btrue = rep(0,p) btrue[1] = 1 btrue[2] = -1 y = X %*% btrue + rnorm(n) y.fit.ebr = ebmr(X,y, maxiter = 200, ebnv_fn = ebnv.pm) y.fit.eblasso = ebmr(X,y, maxiter = 200, ebnv_fn = ebnv.exp) y.fit.eblasso.mode = ebmr(X,y, maxiter = 200, ebnv_fn = ebnv.exp, compute_mode=TRUE) y.fit.ebash = ebmr.alpha:::ebmr.set.prior(y.fit.eblasso,ebmr.alpha:::exp2np(y.fit.eblasso$g)) y.fit.ebash = ebmr.update(y.fit.ebash, maxiter = 200, ebnv_fn = ebnv.np) plot(btrue, coef(y.fit.ebr)) plot(btrue, coef(y.fit.eblasso), col=2) plot(btrue, coef(y.fit.eblasso.mode), col=3) plot(btrue, coef(y.fit.ebash), col=4)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.