Metropolis-Hastings for the log-linear model under a...

This function runs a Metropolis-Hastings algorithm that produces a sample from the
posterior distribution for the probit model coefficient *beta*
associated with a noninformative prior defined in Chapter 4.

1 | ```
hmnoinfprobit(niter, y, X, scale)
``` |

`niter` |
number of iterations |

`y` |
binary response variable |

`X` |
matrix of covariates with the same number of rows as |

`scale` |
scale of the random walk |

The function produces a sample of *beta*'s as a matrix of size `niter`

x `p`

,
where `p`

is the number of covariates.

1 2 3 4 5 6 7 8 9 | ```
data(bank)
bank=as.matrix(bank)
y=bank[,5]
X=bank[,1:4]
noinfprobit=hmflatprobit(1000,y,X,1)
par(mfrow=c(1,3),mar=1+c(1.5,1.5,1.5,1.5))
plot(noinfprobit[,1],type="l",xlab="Iterations",ylab=expression(beta[1]))
hist(noinfprobit[101:1000,1],nclass=50,prob=TRUE,main="",xlab=expression(beta[1]))
acf(noinfprobit[101:1000,1],lag=10,main="",ylab="Autocorrelation",ci=FALSE)
``` |

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.