The hardware and bandwidth for this mirror is donated by METANET, the Webhosting and Full Service-Cloud Provider.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]metanet.ch.
The goal of surbayes is to provide tools for Bayesian analysis of the seemingly unrelated regression (SUR) model. In particular, we implement the direct Monte Carlo (DMC) approach of Zellner and Ando (2010). We also implement a Gibbs sampler to sample from a power prior on the SUR model.
You can install the released version of surbayes from CRAN with:
install.packages("surbayes")
And the development version from GitHub with:
# install.packages("devtools")
::install_github("ethan-alt/surbayes") devtools
This is a basic example which shows you how to sample from the posterior
library(surbayes)
## Taken from bayesm package
= 10 ## number of samples
M set.seed(66)
## simulate data from SUR
= c(1,2)
beta1 = c(1,-1,-2)
beta2 = 100
nobs = 2
nreg = c(rep(1, nobs))
iota = cbind(iota, runif(nobs))
X1 = cbind(iota, runif(nobs), runif(nobs))
X2 = matrix(c(0.5, 0.2, 0.2, 0.5), ncol = 2)
Sigma = chol(Sigma)
U = matrix( rnorm( 2 * nobs ), ncol = 2) %*% U
E = X1 %*% beta1 + E[,1]
y1 = X2 %*% beta2 + E[,2]
y2 = X1[, -1]
X1 = X2[, -1]
X2 = data.frame(y1, y2, X1, X2)
data names(data) = c( paste0( 'y', 1:2 ), paste0('x', 1:(ncol(data) - 2) ))
## run DMC sampler
= list(y1 ~ x1, y2 ~ x2 + x3)
formula.list
## Fit models
= sur_sample( formula.list, data, M = M ) ## DMC used
out_dmc #> Direct Monte Carlo sampling used
= sur_sample( formula.list, data, M, data ) ## Gibbs used
out_powerprior #> Gibbs sampling used for power prior model
These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.