Bayes Factor for Slope Parameters in Latent-Trait MPT
Uses the Savage-Dickey method to compute the Bayes factor that the slope
parameter of a continuous covariate in traitMPT is
zero vs. positive/negative/unequal to zero.
BayesFactorSlope( fittedModel, parameter, direction = "!=", approx = "normal", plot = TRUE, ... )
fittedModel |
a fitted latent-trait model fitted with |
parameter |
name of the slope parameter (e.g., |
direction |
alternative hypothesis: whether slope is smaller or larger
than zero ( |
approx |
how to approximate the posterior density of the slope parameter at zero:
|
plot |
if |
... |
further arguments passed to |
The Bayes factor is computed with the Savage-Dickey method, which is defined as the ratio of the
density of the posterior and the density of the prior evalauted at slope=0.
Note that this method cannot be used with default JZS priors (IVprec="dgamma(.5,.5)")
if more than one predictor is added for an MPT parameter. As a remedy, a g-prior (normal distribution)
can be used on the slopes by setting the hyperprior parameter g to a
fixed constant when fitting the model: traitMPT(..., IVprec = 1).
## Not run:
# latent-trait MPT model for the encoding condition (see ?arnold2013):
EQNfile <- system.file("MPTmodels/2htsm.eqn", package="TreeBUGS")
d.enc <- subset(arnold2013, group == "encoding")
fit <- traitMPT(EQNfile, data = d.enc[, -(1:4)], n.thin=5,
restrictions=list("D1=D2=D3","d1=d2","a=g"),
covData = d.enc[,c("age", "pc")],
predStructure = list("D1 ; age"))
plot(fit, parameter = "slope", type = "default")
summary(fit)
BayesFactorSlope(fit, "slope_D1_age", direction = "<")
## End(Not run)Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.