logp.vs: The log-unnormalized posterior probability of a model for...

View source: R/cal.lop.vs.R

logp.vsR Documentation

The log-unnormalized posterior probability of a model for Bayesian variable selection.

Description

Calculates the log-unnormalized posterior probability of a model.

Usage

logp.vs(model, X, y, lam0 = 0, a0 = 0, b0 = 0, lam, w)

Arguments

model

The indices of active variables.

X

The n\times p covariate matrix without intercept.

y

The response vector of length n.

lam0

The precision parameter for \beta_0. Default: 0 (corresponding to improper uniform prior).

a0

The shape parameter for prior on \sigma^2. Default: 0.

b0

The scale parameter for prior on \sigma^2. Default: 0.

lam

The slab precision parameter.

w

The prior inclusion probability of each variable.

Value

The log-unnormalized posterior probability of the model.

Author(s)

Vivekananda Roy

References

Roy, V.(2024) A geometric approach to informative MCMC sampling https://arxiv.org/abs/2406.09010

Examples

n=50; p=100; nonzero = 3
trueidx <- 1:3
nonzero.value <- 4
TrueBeta <- numeric(p)
TrueBeta[trueidx] <- nonzero.value
rho <- 0.5
xone <- matrix(rnorm(n*p), n, p)
X <- sqrt(1-rho)*xone + sqrt(rho)*rnorm(n)
y <- 0.5 + X %*% TrueBeta + rnorm(n)
result <- geomc.vs(X=X, y=y)
logp.vs(result$median.model,X,y,lam = nrow(X)/ncol(X)^2,w = sqrt(nrow(X))/ncol(X))

geommc documentation built on Oct. 19, 2024, 1:08 a.m.

Related to logp.vs in geommc...