BGLR {BGLR}  R Documentation 
The BGLR (‘Bayesian Generalized Linear Regression’) function fits various types of parametric and semiparametric Bayesian regressions to continuos (censored or not), binary and ordinal outcomes.
BGLR(y, response_type = "gaussian", a=NULL, b=NULL,ETA = NULL, nIter = 1500,
burnIn = 500, thin = 5, saveAt = "", S0 = NULL,
df0 =5, R2 = 0.5, weights = NULL,
verbose = TRUE, rmExistingFiles = TRUE, groups=NULL)
y 
(numeric, 
response_type 
(string) admits values 
a , b 
(numeric, 
ETA 
(list) This is a twolevel list used to specify the regression function (or linear predictor). By default the linear predictor (the conditional expectation function in case of Gaussian outcomes) includes only an intercept. Regression on covariates and other types of random effects are specified in this twolevel list. For instance: ETA=list(list(X=W, model="FIXED"), list(X=Z,model="BL"), list(K=G,model="RKHS")), specifies that the linear predictor should include: an intercept (included by default) plus a linear regression on W with regression coefficients treated as fixed effects (i.e., flat prior), plus regression on Z, with regression coefficients modeled as in the Bayesian Lasso of Park and Casella (2008) plus and a random effect with covariance structure G. For linear regressions the following options are implemented: FIXED (Flat prior), BRR (Gaussian prior), BayesA (scaledt prior), BL (DoubleExponential prior),
BayesB (two component mixture prior with a point of mass at zero and a scaledt slab), BayesC (two component mixture prior with a point of
mass at zero and a Gaussian slab). In linear regressions X can be the incidence matrix for effects or a formula (e.g. 
weights 
(numeric, 
nIter , burnIn , thin 
(integer) the number of iterations, burnin and thinning. 
saveAt 
(string) this may include a path and a prefix that will be added to the name of the files that are saved as the program runs. 
S0 , df0 
(numeric) The scale parameter for the scaled inversechi squared prior assigned to the residual variance, only used with Gaussian outcomes.
In the parameterization of the scaledinverse chi square in BGLR the expected values is 
R2 
(numeric, 
verbose 
(logical) if TRUE the iteration history is printed, default TRUE. 
rmExistingFiles 
(logical) if TRUE removes existing output files from previous runs, default TRUE. 
groups 
(factor) a vector of the same length of y that associates observations with groups, each group will have an associated variance component for the error term. 
BGLR implements a Gibbs sampler for a Bayesian regresion model. The linear predictor (or regression function) includes an intercept (introduced by default) plus a number of userspecified regression components (X) and random effects (u), that is:
η=1μ + X_{1}β_{1}+...+X_{p}β_{p}+u_{1}+...+u_{q}The components of the linear predictor are specified in the argument ETA (see above). The user can specify as many linear terms as desired, and for each component the user can choose the prior density to be assigned. The distribution of the response is modeled as a function of the linear predictor.
For Gaussian outcomes, the linear predictor is the conditional expectation, and censoring is allowed. For censored data points the actual response value (y_i
)
is missing, and the entries of the vectors a and b (see above) give the lower an upper vound for y_i
. The
following table shows the configuration of the triplet (y, a, b) for uncensored, rightcensored,
leftcensored and interval censored.
a  y  b  
Uncensored  NULL  y_i  NULL 
Right censored  a_i  NA  \infty 
Left censored  \infty  NA  b_i 
Interval censored  a_i  NA  b_i

Internally, censoring is dealt with as a missing data problem.
Ordinal outcomes are modelled using the probit link, implemented via data augmentation. In this case the linear predictor becomes the mean of the underlying liability variable which is normal with mean equal to the linear predictor and variance equal to one. In case of only two classes (binary outcome) the threshold is set equal to zero, for more than two classess thresholds are estimated from the data. Further details about this approach can be found in Albert and Chib (1993).
A list with estimated posterior means, estimated posterior standard deviations, and the parameters used to fit the model. See the vignettes in the package for further details.
Gustavo de los Campos, Paulino Perez Rodriguez,
Albert J,. S. Chib. 1993. Bayesian Analysis of Binary and Polychotomus Response Data. JASA, 88: 669679.
de los Campos G., H. Naya, D. Gianola, J. Crossa, A. Legarra, E. Manfredi, K. Weigel and J. Cotes. 2009. Predicting Quantitative Traits with Regression Models for Dense Molecular Markers and Pedigree. Genetics 182: 375385.
de los Campos, G., D. Gianola, G. J. M., Rosa, K. A., Weigel, and J. Crossa. 2010. Semiparametric genomicenabled prediction of genetic values using reproducing kernel Hilbert spaces methods. Genetics Research, 92:295308.
Park T. and G. Casella. 2008. The Bayesian LASSO. Journal of the American Statistical Association 103: 681686.
Spiegelhalter, D.J., N.G. Best, B.P. Carlin and A. van der Linde. 2002. Bayesian measures of model complexity and fit (with discussion). Journal of the Royal Statistical Society, Series B (Statistical Methodology) 64 (4): 583639.
## Not run:
#Demos
library(BGLR)
#BayesA
demo(BA)
#BayesB
demo(BB)
#Bayesian LASSO
demo(BL)
#Bayesian Ridge Regression
demo(BRR)
#BayesCpi
demo(BayesCpi)
#RKHS
demo(RKHS)
#Binary traits
demo(Bernoulli)
#Ordinal traits
demo(ordinal)
#Censored traits
demo(censored)
## End(Not run)