Description Usage Arguments Details Value Author(s) Examples
Replicate and summarize the generation and log-linear analysis of data sets that are consistent with arbitrary log-linear 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 log-linear 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 log-linear 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 log-linear 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 "log-linear 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 log-linear 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)
|
[1] "c1" "c2" "c3" "c4" "c12" "c13" "c14" "c23" "c24" "c34"
[11] "c123" "c124" "c134" "c234"
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.