Learn R Programming

MRCV (version 0.2-0)

MRCV-internal: Internal MRCV Package Functions

Description

Hidden internal MRCV package functions not meant to be called by the user.

Usage

check.margins(data, I, J, K, nvars, model.vars, item.names)

check.min(value)

check.zero(value, add.constant = .5)

data.format(data, I, J, K, nvars, add.constant = .5, model.vars = NULL, 
    predict.func = FALSE)
    
est.jack(mu.hat, i, I, J, K)

ipf.genloglin(data, I, J, K, nvars, p, p.theta.2, p.theta.3, x.theta.2, 
    x.theta.3)

Arguments

data
For check.margins, the marginal counts for a bootstrap resample. For data.format and observed data, a data frame containing the raw MRCV data. For bootstrap resamples, a data frame containing the joint table cell counts. Fo
I
The number of items corresponding to row variable W.
J
The number of items corresponding to column variable Y.
K
The number of items corresponding to strata variable Z.
nvars
The number of MRCVs.
model.vars
For check.margins and the two MRCV case, a data frame containing 2Ix2J rows and 4 columns generically named W, Y, wi, and yj. For the three MRCV case, a data frame containing 2Ix2Jx2K rows
item.names
The names of the MRCV items as labeled and ordered in the data frame containing the raw MRCV data.
value
A numeric vector of length = 1.
add.constant
A positive constant to be added to all zero marginal cell counts.
predict.func
A logical value indicating whether predict.genloglin is being called.
mu.hat
A data frame containing the estimated counts from a model based on n-1 subjects.
i
The current index value for the predict.genloglin for() loop.
p
A data frame with 2^(I+J) (or 2^(I+J+K)) rows and column variables W1,...,WI, Y1,...,YJ, Z1,...,ZK, and p (in this order). The third set of items is only necessary
p.theta.2
For the two MRCV case. See Gange (1995, p. 136) for details. Note that ipf.genloglin uses cell counts instead of probabilities.
p.theta.3
For the three MRCV case. See Gange (1995, p. 136) for details. Note that ipf.genloglin uses cell counts instead of probabilities.
x.theta.2
For the two MRCV case. See Gange (1995, p. 136) for details. Note that ipf.genloglin uses cell counts instead of probabilities.
x.theta.3
For the three MRCV case. See Gange (1995, p. 136) for details. Note that ipf.genloglin uses cell counts instead of probabilities.

Value

  • The check.margins function returns a logical value indicating whether the resample is valid. The check.min function returns a numeric object equal to 1 if value > 1; otherwise, the original value is returned. The check.zero function returns a numeric object equal to add.constant if value = 0; otherwise, the original value is returned. The data.format function returns a summary data frame containing the marginal counts. The est.jack function returns the model-predicted odds ratio using data from n-1 subjects. The ipf.genloglin function returns an updated version of p containing the mth iterative estimate of the multinomial probabilities.

Details

The check.margins function is used to determine whether a bootstrap resample can be validly used by the genloglin function. A resample is valid only if all binary items have at least one positive and one negative response. The check.min function is called by MI.test to compute the minimum fora Bonferroni adjustment that results in a p-value equal to the minimum of 1 and the adjusted p-value. The check.zero function is used to add a small constant to zero cell counts. This is necessary to prevent zero or undefined odds ratio estimates, and to ensure correct convergence of the iterative proportional fitting algorithm described in Gange (1995). The data.format function is used to convert raw or bootstrap data for two or three MRCVs into a data frame containing the marginal counts. The est.jack function calculates model-predicted odds ratios. The ipf.genloglin function carries out the mth iteration of the iterative proportional fitting algorithm described by Gange (1995, p. 136). This function is called iteratively by genloglin until the convergence criterion is reached.

References

Gange, S. (1995) Generating multivariate categorical variables using the iterative proportional fitting algorithm. The American Statistician, 49, 134--138.