Description Usage Arguments Details Examples
View source: R/probit_horseshoe_regression.R
The probit regression model with horseshoe prior is given by
y_i|π_i \sim Bernoulli(π_i),
π_i = Φ(x_i^tβ),
[β_j|λ_j] \sim N(0, λ_j^2), j=2,...,p,
p(β_1) \propto 1,
[λ_j|A] \sim C^{+}(0, A), j=2,...,p,
A \sim Uniform(0, 10).
where Φ is given by the gaussian CDF.
The implemented parameter-expanded model is given by
y_i^* = x_i^tβ + ε_i,
ε_i \sim N(0, 1),
y_i = I(y_i^* > 0).
The half-Cauchy parameter expansion is also used; given by
[η_j|γ_j] \sim Gamma(\frac{1}{2}, γ_j),
[γ_j] \sim Gamma(\frac{1}{2}, \frac{1}{A^2})
and η_j = λ_j^{-2} , τ_A = A^{-2} , The full conditionals are given by:
[y_i^*|y_i, β, X] \sim sgn(y_i, y_i^*)N(x_i^tβ, 1)
where sqn is 1 if both arguments are of the same sign and zero otherwise,
[β|Y^*, X, η] \sim \mathcal{N}(Q^{-1}l, Q^{-1})
where Q = X'X+diag(0, 1/η_2, ..., 1/η_p) and l = X'Y^*,
[η_j|β_j, γ_j] \sim \mathrm{exp}(\frac{β_j^2}{2} + γ_j),
[γ_j|η_j, τ_A] \sim \mathrm{exp}(η_j + τ_A),
[τ_A|γ] \sim \mathrm{Gamma}( \frac{p - 2}{2}, ∑ γ_i)\mathrm{I}_{(\frac{1}{100}, ∞)}.
1 2 3 4 5 | probit_horseshoe_regression <- function(
Y,
X,
niter,
init = NULL)
|
Y |
n by 1 vector of ones and zeros |
X |
n by p predictor matrix, where p > 1 and the first column of X is all 1. |
niter |
number of gibbs sampling iterations |
init |
Initial starting values for beta. If NULL, beta is set to zero. |
This function returns a niter x p matrix of values where p is the second dimension of the predictor matrix X. The returned matrix contains all generated values of the gibbs sampling markov chain.
1 | print("TODO")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.