Learn R Programming

logmult (version 0.7.4)

svyassocmod: Fitting Association Models With Complex Survey Data

Description

Fit association models to data from a complex survey design, with inverse-probability weighting and (optionally) standard errors based on replicate weights.

Usage

svyrc(formula, design, nd = 1,
      symmetric = FALSE, diagonal = FALSE,
      weighting = c("marginal", "uniform", "none"),
      rowsup = NULL, colsup = NULL,
      Ntotal = nrow(design), exclude = c(NA, NaN),
      se = c("none", "replicate"),
      ncpus = getOption("boot.ncpus"),
      family = quasipoisson, weights = NULL,
      start = NULL, etastart = NULL, tolerance = 1e-8,
      iterMax = 5000, trace = FALSE, verbose = TRUE, ...)

svyhmskew(formula, design, nd.symm = NA, diagonal = FALSE, weighting = c("marginal", "uniform", "none"), rowsup = NULL, colsup = NULL, Ntotal = nrow(design), exclude = c(NA, NaN), se = c("none", "replicate"), ncpus = getOption("boot.ncpus"), family = quasipoisson, weights = NULL, start = NULL, etastart = NULL, tolerance = 1e-8, iterMax = 5000, trace = FALSE, verbose = TRUE, ...)

svyyrcskew(formula, design, nd.symm = NA, nd.skew = 1, diagonal = FALSE, weighting = c("marginal", "uniform", "none"), rowsup = NULL, colsup = NULL, Ntotal = nrow(design), exclude = c(NA, NaN), se = c("none", "replicate"), ncpus = getOption("boot.ncpus"), family = quasipoisson, weights = NULL, start = NA, etastart = NULL, tolerance = 1e-8, iterMax = 15000, trace = FALSE, verbose = TRUE, ...)

svyrcL(formula, design, nd = 1, layer.effect = c("homogeneous.scores", "heterogeneous", "none"), symmetric = FALSE, diagonal = c("none", "heterogeneous", "homogeneous"), weighting = c("marginal", "uniform", "none"), Ntotal = nrow(design), exclude = c(NA, NaN), se = c("none", "replicate"), ncpus = getOption("boot.ncpus"), family = quasipoisson, weights = NULL, start = NULL, etastart = NULL, tolerance = 1e-8, iterMax = 5000, trace = FALSE, verbose = TRUE, ...)

svyrcL.trans(formula, design, nd = 1, symmetric = FALSE, diagonal = c("none", "heterogeneous", "homogeneous"), weighting = c("marginal", "uniform", "none"), Ntotal = nrow(design), exclude = c(NA, NaN), se = c("none", "replicate"), ncpus = getOption("boot.ncpus"), family = quasipoisson, weights = NULL, start = NULL, etastart = NULL, tolerance = 1e-8, iterMax = 5000, trace = FALSE, verbose = TRUE, ...)

svyhmskewL(formula, design, nd.symm = NA, layer.effect.skew = c("homogeneous.scores", "heterogeneous", "none"), layer.effect.symm = c("heterogeneous", "uniform", "homogeneous.scores", "none"), diagonal = c("none", "heterogeneous", "homogeneous"), weighting = c("marginal", "uniform", "none"), Ntotal = nrow(design), exclude = c(NA, NaN), se = c("none", "replicate"), ncpus = getOption("boot.ncpus"), family = quasipoisson, weights = NULL, start = NULL, etastart = NULL, tolerance = 1e-8, iterMax = 5000, trace = FALSE, verbose = TRUE, ...)

Arguments

formula

a formula specifying margins for the table (using ‘+’ only) on which the model will be fitted (passed to svytable); dimensions of the resulting table must match the models expectations.

design

a survey object; if se == "replicate", must be of class svrepdesign (see “Details” below).

nd

the number of dimensions to include in the model. Cannot exceed min(nrow(tab) - 1, ncol(tab) - 1) if symmetric is FALSE (saturated model), and twice this threshold otherwise (quasi-symmetry model).

nd.symm

the number of dimensions to include in the symmetric RC(M) association. Cannot exceed 2 * min(nrow(tab) - 1, ncol(tab) - 1) (quasi-symmetry model). If NA (the default), a full quasi-symmetric association is used instead of a RC(M) model; if 0, quasi-independence is used.

nd.skew

the number of dimensions to include in the skew-symmetric RC(M) association.

layer.effect

determines the form of the interaction between row-column association and layers. See “Details” below.

layer.effect.skew

determines the form of the interaction between skew-symmetric association and layers. See “Details” below.

layer.effect.symm

determines the form of the interaction between symmetric row-column association, or quasi-symmetric association (if nd.symm = NA) and layers. See “Details” below.

symmetric

should row and column scores be constrained to be equal? Valid only for square tables.

diagonal

what type of diagonal-specific parameters to include in the model, if any. Only makes sense when nd.symm is not NA (else, diagonal parameters are already included).

weighting

what weights should be used when normalizing the scores.

Ntotal

sum of counts to normalize the table to (passed to svytable). See “Details” below..

exclude

a vector of values to be exclude when building the table, passed to xtabs.

rowsup

if present, a matrix with the same columns as tab and rows corresponding to the columns of colsup, giving supplementary (passive) rows.

colsup

if present, a matrix with the same rows as tab and columns corresponding to the rows of colsup, giving supplementary (passive) columns.

se

whether to compute replicate standard errors or not (only supported for svrepdesign objects).

ncpus

the number of processes to use for jackknife or bootstrap parallel computing. Defaults to the number of cores (see detectCores), with a maximum of 5, but falls back to 1 (no parallelization) if package parallel is not available.

family

a specification of the error distribution and link function to be used in the model. This can be a character string naming a family function; a family function, or the result of a call to a family function. See family details of family functions.

weights

an optional vector of weights to be used in the fitting process.

start

either NA to use optimal starting values, NULL to use random starting values, or a vector of starting values for the parameters in the model.

etastart

starting values for the linear predictor; set to NULL to use either default starting values (if start = NA), or random starting values (in all other cases).

tolerance

a positive numeric value specifying the tolerance level for convergence; higher values will speed up the fitting process, but beware of numerical instability of estimated scores!

iterMax

a positive integer specifying the maximum number of main iterations to perform; consider raising this value if your model does not converge.

trace

a logical value indicating whether the deviance should be printed after each iteration.

verbose

a logical value indicating whether progress indicators should be printed, including a diagnostic error message if the algorithm restarts.

more arguments to be passed to gnm

Value

An assocmod object whose exact class depends on the function called.

Details

The model is fitted to a table with probabilities estimated by svytable and (when Ntotal = nrow(design)) with the sample size equal to the observed sample size, treating the resulting table as if it came from iid multinomial sampling, as described by Rao and Scott. This assumption affects the fit statistics but not parameter point estimates.

Standard errors that do not rely on this assumption can be computed by fitting the model using each series of replicate weights. If your data does not come with replicate weights, use as.svrepdesign to create them first, and pass the resulting svrepdesign object via the design argument.

References

Rao, J.N.K., Scott, A.J. (1984). On Chi-squared Tests For Multiway Contingency Tables with Proportions Estimated From Survey Data. Annals of Statistics 12, 46-60.

See Also

rc, hmskew, yrcskew, rcL, rcL.trans, hmskewL

svytable, svyloglin, svyglm, as.svrepdesign