Question

This is an R question: How can I use the posterior for beta 1 in linear regression (MCMC) to calc...

This is an R question: How can I use the posterior for beta 1 in linear regression (MCMC) to calculate the posterior for ((1)/(1-beta1)), report its HPD, and highest posterior value? Anything with the brms package perhaps?

0 0
Add a comment Improve this question Transcribed image text
Answer #1
Liner Regression(MCMC):

Let # denote the intractable posterior density that results when the standard default prior is placed on the parameters in a linear regression model with iid Laplace errors. We have to analyze the Markov chains underlying two different Markov chain Monte Carlo algorithms for exploring #. In particular, it is shown that the Markov operators associated with the data augmentation algorithm and a sandwich variant are both trace-class. Consequently, both Markov chains are geometrically ergodic. It is also established that for each i∈{1,2,3,…}, the ith largest eigenvalue of the sandwich operator is less than or equal to the corresponding eigenvalue of the data augmentation operator. It follows that the sandwich algorithm converges at least as fast as the data augmentation algorithm.

Code:
bayes.regress(data.values=NULL, 
              beta.prior=list("flat"), 
              sigmasq.prior=list("inverse.gamma", 1.0, 1.0, 1.0),
              Tsamp.out=1000, zero.intercept=FALSE)

HPD Report:

the following function uses Bayesian linear regression model which is defined as-

y_i=x_i' β + ε_i,

where i = 1,...,numsamp.data; ε_i ~ N(0,σ^2); k is the number of predictor variables. The function specified above uses user-supplied prior distributions for β and σ^2.

The Gibbs sampler is used to sample from all full conditional posterior distributions, which only depend on the summary statistics X'X, X'Y and Y'Y (and Y'X = (X'Y)'); these summary statistics are calculated by the function read.regress.data.ff() (in this package), or can be provided by the user. Starting values are not needed for the vector β, here this vector is updated first, conditioned on all other unknown model parameters and the data.

Relation with BRMS Package:

The brms package provides an interface to fit Bayesian generalized (non-)linear multivariate multilevel models using Stan, which is a R package for performing full Bayesian inference. The formula syntax is very similar to that of the package lme4 to provide a familiar and simple interface for performing regression analyses. Further modeling options include non-linear and smooth terms, auto-correlation structures, censored data, missing value imputation, and quite a few more. In addition, all parameters of the response distribution can be predicted in order to perform distributional regression. Multivariate models can be fit, as well. Prior specifications are flexible and explicitly encourage users to apply prior distributions that actually reflect their beliefs. Model fit can easily be assessed and compared with posterior predictive checks, cross-validation, and Bayes factors.

Add a comment
Know the answer?
Add Answer to:
This is an R question: How can I use the posterior for beta 1 in linear regression (MCMC) to calc...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT