| mombf {mombf} | R Documentation |
mombf computes moment Bayes factors to test whether a subset of
regression coefficients are equal to some user-specified value.
imombf computes inverse moment Bayes factors.
zellnerbf computes Bayes factors based on the Zellner-Siow
prior (used to build the moment prior).
mombf(lm1, coef, g, prior.mode, theta0, logbf = FALSE) imombf(lm1, coef, g, prior.mode, nu = 1, theta0 , method='adapt', nquant=100, B = 10^5)
lm1 |
Linear model fit, as returned by lm1. |
coef |
Vector with indexes of coefficients to be
tested. e.g. coef==c(2,3)
and theta0==c(0,0) tests coef(lm1)[2]=coef(lm1)[3]=0. |
g |
Vector with prior parameter values. See dmom and
dimom for details. |
prior.mode |
If specified, g is determined by calling
g2mode. |
theta0 |
Null value for the regression coefficients. Defaults to 0. |
logbf |
If logbf==TRUE the natural logarithm of the Bayes
factor is returned. |
nu |
Prior parameter for the inverse moment prior. See
dimom for details. Defaults to nu=1, which Cauchy-like
tails. |
method |
Numerical integration method to compute the bivariate
integral (only used by imombf).
For method=='adapt', the inner integral is evaluated (via integrate) at a series of
nquant quantiles of the residual variance posterior distribution, and then
averaged as described in Johnson (1992).
Set method=='MC' to use Monte Carlo integration. |
nquant |
Number of quantiles at which to evaluate the integral
for known sigma. Only used if method=='adapt'. |
B |
Number of Monte Carlo samples to estimate the inverse moment
Bayes factor. Only used if method=='MC'. |
These functions actually call momunknown and
imomunknown, but they have a simpler interface.
See dmom and dimom for details on the moment and inverse
moment priors.
The Zellner-Siow g-prior is given by dmvnorm(theta,theta0,n*g*V1).
mombf returns the moment Bayes factor to compare the model where
theta!=theta0
with the null model where theta==theta0. Large values favor the
alternative model; small values favor the null.
imombf returns
inverse moment Bayes factors.
zellnerbf returns Bayes factors based on the Zellner-Siow g-prior.
David Rossell
See http://rosselldavid.googlepages.com for technical reports. For details on the quantile integration, see Johnson, V.E. A Technique for Estimating Marginal Posterior Densities in Hierarchical Models Using Mixtures of Conditional Densities. Journal of the American Statistical Association, Vol. 87, No. 419. (Sep., 1992), pp. 852-860.
momunknown,
imomunknown and zbfunknown for another interface to compute Bayes
factors. momknown, imomknown and zbfknown
to compute Bayes factors assuming that the dispersion parameter
is known, and for approximate Bayes factors for
GLMs. mode2g for prior elicitation.
##compute Bayes factor for Hald's data data(hald) lm1 <- lm(hald[,1] ~ hald[,2] + hald[,3] + hald[,4] + hald[,5]) # Set g so that prior mode for standardized effect size is at 0.2 prior.mode <- .2^2 V <- summary(lm1)$cov.unscaled gmom <- mode2g(prior.mode,prior='Mom') gimom <- mode2g(prior.mode,prior='iMom') # Set g so that interval (-0.2,0.2) has 5% prior probability # (in standardized effect size scale) priorp <- .05; q <- .2 gmom <- c(gmom,priorp2g(priorp=priorp,q=q,prior='Mom')) gimom <- c(gmom,priorp2g(priorp=priorp,q=q,prior='iMom')) mombf(lm1,coef=2,g=gmom) #moment BF imombf(lm1,coef=2,g=gimom,B=10^5) #inverse moment BF zellnerbf(lm1,coef=2,g=1) #BF based on Zellner's g-prior