Description Usage Arguments Details Value Author(s) Examples
Replicate and summarize the generation and loglinear analysis of data sets that are consistent with arbitrary loglinear models
1 2 3 
n.grid 
A vector of positive integers, by default 
n.reps 
The number of replicates for each integer in 
u.vec 
A vector of loglinear parameters, excluding the intercept term. The length of the vector and the order
of its terms must correspond to the column names of the design matrix produced by 
p0 
Optional: a number in 
models 
See 
ic 
See 
cell.adj 
See 
averaging 

fixed.sample.size 
Logical: If 
u.vec
, together with the constraint that the multinomial probabilities sum to 1,
uniquely determines the unspecified intercept term. Specifying p0
overdetermines
the intercept term. We rectify this overspecification by adjusting all main effects by the same
additive adjustment a
, where the unique value of a
is approximated with numerical methods.
Once the loglinear terms are fully specified, we perform multinomial draws to simulate a CRC experiment.
We include the zero cell in the multinomial draw only if fixed.sample.size = TRUE
.
On each replicate, the data loglinear model search according to the parameters models
,
ic
, cell.adj
, and averaging
produces an estimate of the missing cell. The
main matrix res
of simulation results stores the ratios of the estimated missing cell over
the 'true' missing cell.
A list of class llsim
, for "loglinear simulations". The list contains the set of multinomial
capture pattern probabilities p
, the matrix res
of simulation results, and many of the
arguments to the llm.sim
.
Zach Kurtz
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15  ## Not run:
## A basic simulation with four lists.
# Begin by specifying the vector of loglinear parameters.
# The parameters must match the design matrix:
names(make.design.matrix(k=4))
u.vec = initialize.u.vec(k=4)
u.vec[5:10] = 2
## Run the simulation with an adjustment to the main effects in
# u.vec such that the probability of nondetection is 0.5.
sim = llm.sim(n.grid = c(100,300,900,2700), n.reps = 10, u.vec,
p0 = 0.5, ic = "BIC", cell.adj = FALSE)
# View the results
plot(sim)
## End(Not run)

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.
Please suggest features or report bugs in the GitHub issue tracker.
All documentation is copyright its authors; we didn't write any of that.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.