mcexact(formula, data, stat = gof, dens = hyper, nosim = 10 ^ 3, method = "bab", savechain = FALSE, tdf = 3, maxiter = nosim, p = NULL, batchsize = NULL)
build.mcx.obj(formula, data, stat = gof, dens = hyper, nosim = 10 ^ 3, method = "bab", savechain = FALSE, tdf = 3, maxiter = nosim, p = NULL, batchsize = NULL)
glm
function(y, mu.hat)
where y
is the observed and mu.hat
are the fitted
values. Current default gof
is a bivariate function of the
deviance and the Pearson chi-squared.function(y)
. Current default is (proportional to) the log of
the generalized hypergeometric density.method = "bab"
or the MCMC approach of
Caffo and Booth method = "cab"
.TRUE
saves the values of the chain.method = "bab"
number of iterations is
different from the number of simulations. maxiter
is a
bound on the total number of iterations.method = "cab"
.method = "cab"
."bab"
or "cab"
depending
on method
. The list contains all of the inputs plus all
required information to resume the simulation. Generic functions
print
and summary
format the output while update
can be used to resume simulations. mcexact
is the front end while
build.mcx.obj
simply builds the basic object that mcexact
applies to.
simulate.conditional
generates a matrix of simulated tables.
http://www.biostat.jhsph.edu/~bcaffo/downloads.htm
fisher.test
#library(mcexact)
set.seed(1)
#importance sampling
data(residence.dat)
mcx <- mcexact(y ~ res.1985 + res.1980 + factor(sym.pair), data = residence.dat)
summary(mcx)
#mcmc
data(pathologist.dat)
mcx <- mcexact(y ~ factor(A) + factor(B) + I(A * B),
data = pathologist.dat,
method = "cab",
p = .5,
nosim = 10 ^ 4,
batchsize = 100)
summary(mcx)
Run the code above in your browser using DataLab