Fit association models to data from a complex survey design, with inverse-probability weighting and (optionally) standard errors based on replicate weights.
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, ...)
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.
a survey object; if se == "replicate"
, must be of class
svrepdesign
(see “Details” below).
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).
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.
the number of dimensions to include in the skew-symmetric RC(M) association.
determines the form of the interaction between row-column association and layers. See “Details” below.
determines the form of the interaction between skew-symmetric association and layers. See “Details” below.
determines the form of the interaction between symmetric row-column association,
or quasi-symmetric association (if nd.symm = NA
) and layers. See “Details” below.
should row and column scores be constrained to be equal? Valid only for square tables.
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).
what weights should be used when normalizing the scores.
sum of counts to normalize the table to (passed to svytable
).
See “Details” below..
a vector of values to be exclude when building the table, passed to xtabs
.
if present, a matrix with the same columns as tab
and rows corresponding to the columns
of colsup
, giving supplementary (passive) rows.
if present, a matrix with the same rows as tab
and columns corresponding to the rows of
colsup
, giving supplementary (passive) columns.
whether to compute replicate standard errors or not (only supported for svrepdesign
objects).
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.
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.
an optional vector of weights to be used in the fitting process.
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.
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).
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!
a positive integer specifying the maximum number of main iterations to perform; consider raising this value if your model does not converge.
a logical value indicating whether the deviance should be printed after each iteration.
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
An assocmod
object whose exact class depends on the function called.
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.
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.