The N(0, prior_sd^2) prior keeps the Hessian invertible under separation. The approximation is centred at the MODE and scaled by the inverse Hessian. An intercept column is prepended; do not include one.
Details
Formula: Newton step beta <- beta + (X'WX + I/s^2)^-1 (X'(y - p) - beta/s^2), W = diag(p_i(1 - p_i)); Var(beta) ~= (X'WX + I/s^2)^-1
References
Gelman, Carlin, Stern, Dunson, Vehtari & Rubin (2013), Bayesian Data Analysis, 3rd edition, Section 4.1 and Chapter 16.
Examples
set.seed(1)
X <- cbind(1, matrix(rnorm(40), 20, 2))
y <- rbinom(20, 1, 0.5)
Bayeslogit(X, y)
#> $estimate
#> [1] -0.08970193 -0.08970193 -0.19423151 0.47370852
#>
#> $se
#> [1] 7.0749519 7.0749519 0.5262784 0.5848783
#>
#> $log_posterior
#> [1] -13.27426
#>
#> $iterations
#> [1] 5
#>
#> $converged
#> [1] 1
#>
#> $n
#> [1] 20
#>
#> $p
#> [1] 4
#>
#> $method
#> [1] "Logistic regression posterior mode, BDA3 Section 4.1"
#>
#> attr(,"class")
#> [1] "morie_rich_result" "list"
