# Internal varbvs functions

### Description

Internal varbvs functions

### Usage

1 2 3 4 5 6 7 8 9 10 11 12 13 14 | ```
diagsq(X,a = NULL)
diagsqt(X,a = NULL)
var1(x)
var1.cols(X)
varbvspve(X,fit,nr = 1000)
varbvsnorm(X,y,sigma,sa,logodds,alpha,mu,tol = 1e-4,maxiter = 1e4,
verbose = TRUE,outer.iter = NULL,update.sigma = TRUE,
update.sa = TRUE,n0 = 0,sa0 = 0)
varbvsbin(X,y,sa,logodds,alpha,mu,eta,tol = 1e-4,maxiter = 1e4,
verbose = TRUE,outer.iter = NULL,update.sa = TRUE,
optimize.eta = TRUE,n0 = 0,sa0 = 0)
varbvsbinz(X,Z,y,sa,logodds,alpha,mu,eta,tol = 1e-4,maxiter = 1e4,
verbose = TRUE,outer.iter = NULL,update.sa = TRUE,
optimize.eta = TRUE,n0 = 0,sa0 = 0)
``` |

### Details

These functions are only intended to be used by expert
users. Here we provide brief descriptions of some of these internal
functions. `diagsq(X,a)`

and `diagsqt(X,a)`

compute the
diagonal entries of the matrix products *X'*A*X* and *X*A*X'*,
respectively, where `A = diag(a)`

, but the computation is done
more efficiently, and without having to store an intermediate matrix
of the same size as the matrix.

`var1(x)`

returns the second moment of vector x about its mean.

`var1.cols(X)`

computes the second moment of each column of X about
its mean.

`varbvspve`

draws posterior estimates of the proportion of
variance in Y explained by the Bayesian variable selection model
fitted using a variational approximation. This function is only valid
for the linear regression model `(family = "gaussian")`

.

Functions `varbvsnorm`

, `varbvsbin`

and `varbvsbinz`

implement the co-ordinate ascent algorithm to fit the fully-factorized
variational approximation for Bayesian variable selection, conditioned
on settings of the hyperparameters. These functions implement the
algorithm for the linear regression, logistic regression with an
intercept, and logistic regression with arbitrary covariates,
respectively.

### Author(s)

Peter Carbonetto <peter.carbonetto@gmail.com>