IndepMH.Rd
IndepMH
computes random draws of parameters using a specified proposal distribution.
IndepMH(data, propob = NULL, posterior = NULL, iter = 1500, burn = 500, vscale = 1.5, start = NULL, prior = "Uniform", mu = 0, sig = 10)
data | data required for the posterior distribution |
---|---|
propob | a list of mean and variance-covariance of the normal proposal distribution;
defaults to |
posterior | the posterior distribution. It is set to null in order to use the logit posterior.
The user can specify log posterior as a function of parameters and data (pars,data). For a more
flexible and generic implementation, use |
iter | number of random draws desired (default: 1500) |
burn | burn-in period for the MH algorithm (default: 500) |
vscale | a positive value to scale up or down the variance-covariance matrix in the proposal distribution |
start | starting values of parameters for the MH algorithm. It is automatically generated but the user can also specify. |
prior | the prior distribution (default: "Normal", alternative: "Uniform") |
mu | the mean of the normal prior distribution (default:0) |
sig | the variance of the normal prior distribution (default:10) |
val a list of matrix of draws pardraws and the acceptance rate
y = indicat(faithful$waiting,70) x = scale(cbind(faithful$eruptions,faithful$eruptions^2)) data = data.frame(y,x); propob<- lapl_aprx(y,x) IndepMH_n<- IndepMH(data=data,propob,iter = 102, burn = 2) # prior="Normal"#> IndepMH algorithm successful. Acceptance ratio = 0.3921569IndepMH_u<- IndepMH(data=data,propob,prior="Uniform",iter = 102, burn = 2) # prior="Uniform"#> IndepMH algorithm successful. Acceptance ratio = 0.4607843