blma | R Documentation |
Perform Bayesian Linear Model Averaging over all of the possible linear models where vy is the response and the covariates are in mX.
blma(vy, mX, prior = "BIC", modelprior = "uniform", modelpriorvec = NULL)
vy |
Vector of responses |
mX |
Covariate matrix |
prior |
– the choice of mixture $g$-prior used to perform Bayesian model averaging. The choices available include:
|
modelprior |
The model prior to use. The choices of model prior are "uniform", "beta-binomial" or "bernoulli". The choice of model prior dictates the meaning of the parameter modelpriorvec. |
modelpriorvec |
If modelprior is "uniform", then the modelpriorvec is ignored and can be null. If modelprior is "beta-binomial" then modelpriorvec should be length 2 with the first element containing alpha hyperparameter for the beta prior and the second element containing the beta hyperparameter for beta prior. If modelprior is "bernoulli", then modelpriorvec must be of the same length as the number columns in mX. Each element i of modelpriorvec contains the prior probability of the the ith covariate being included in the model. |
cores |
The number of cores to use. Defaults to 1 |
A list containing
the vector of correlations for each model
the vector of number of covariates for each model
the vector of logs of the Bayes Factors of each model
the vector of inclusion probabilities for each of the covariates
Bayarri, M. J., Berger, J. O., Forte, A., Garcia-Donato, G., 2012. Criteria for Bayesian model choice with application to variable selection. Annals of Statistics 40 (3), 1550-1577.
Greenaway, M. J., J. T. Ormerod (2018) Numerical aspects of Bayesian linear models averaging using mixture g-priors.
Liang, F., Paulo, R., Molina, G., Clyde, M. a., Berger, J. O., 2008. Mixtures of g priors for Bayesian variable selection. Journal of the American Statistical Association 103 (481), 410-423.
Ormerod, J. T., Stewart, M., Yu, W., Romanes, S. E., 2017. Bayesian hypothesis tests with diffuse priors: Can we have our cake and eat it too?
mD <- MASS::UScrime
notlog <- c(2,ncol(MASS::UScrime))
mD[,-notlog] <- log(mD[,-notlog])
for (j in 1:ncol(mD)) {
mD[,j] <- (mD[,j] - mean(mD[,j]))/sd(mD[,j])
}
varnames <- c(
"log(AGE)",
"S",
"log(ED)",
"log(Ex0)",
"log(Ex1)",
"log(LF)",
"log(M)",
"log(N)",
"log(NW)",
"log(U1)",
"log(U2)",
"log(W)",
"log(X)",
"log(prison)",
"log(time)")
vy <- mD$y
mX <- data.matrix(cbind(mD[1:15]))
colnames(mX) <- varnames
blma_result <- blma(vy, mX, "BIC")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.