Description Usage Arguments Details Value
View source: R/fn_restrictedBayesLm.R
Fits the linear regression model β~N(μ_0, Σ_0), σ^2~IG(a0, b0), y~N(Xβ, σ^2 I)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | restrictedBayesLm(
y,
X,
regEst = "Huber",
scaleEst = "Huber",
mu0,
Sigma0,
a0,
b0,
sigma2Int,
nkeep = 10000,
nburn = 1000,
maxit = 400
)
|
y |
vector of repsonse |
X |
design matrix for regression. If intercept is desired, a column of 1's is needed |
regEst |
The estimator of β to condition on. Current options available are |
scaleEst |
The estimator of σ to condition on. Currently Huber's proposal 2 is the only option available. Specified with |
mu0 |
prior mean for beta |
Sigma0 |
prior var-cov matrix for β |
a0 |
prior shape parameter for σ^2 |
b0 |
prior scale parameter for σ^2 |
nkeep |
number of iterations to keep |
nburn |
number of iterations to toss |
maxit |
maximum number of iterations for use in |
Uses Gibbs sampling to sample from the restricted posterior under the above linear regression model conditioned on estimators regEst
and scaleEst
for β and σ, respectively. This is just the Gibbs sampler for the full posterior (implemented in brlm::bayesLm
augmented with a step to sample new data given all of the parameters and the observed conditioning statistics
list with mcmc sample, mean fitted values, robust regression object from rlm
, and observed conditioning statistics.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.