RE_cor {multinma} | R Documentation |
Random effects structure
Description
Use RE_cor
to generate the random effects correlation matrix, under the
assumption of common heterogeneity variance (i.e. all within-study
correlations are 0.5). Use which_RE
to return a vector of IDs for the RE
deltas (0 means no RE delta on this arm).
Usage
RE_cor(study, trt, contrast, type = c("reftrt", "blshift"))
which_RE(study, trt, contrast, type = c("reftrt", "blshift"))
Arguments
study |
A vector of study IDs (integer, character, or factor) |
trt |
A factor vector of treatment codes (or coercible as such), with first level indicating the reference treatment |
contrast |
A logical vector, of the same length as |
type |
Character string, whether to generate RE structure under the "reference treatment" parameterisation, or the "baseline shift" parameterisation. |
Value
For RE_cor()
, a correlation matrix of dimension equal to the number
of random effects deltas (excluding those that are set equal to zero).
For which_RE()
, an integer vector of IDs indexing the rows and columns of
the correlation matrix returned by RE_cor()
.
Examples
RE_cor(smoking$studyn, smoking$trtn, contrast = rep(FALSE, nrow(smoking)))
RE_cor(smoking$studyn, smoking$trtn, contrast = rep(FALSE, nrow(smoking)), type = "blshift")
which_RE(smoking$studyn, smoking$trtn, contrast = rep(FALSE, nrow(smoking)))
which_RE(smoking$studyn, smoking$trtn, contrast = rep(FALSE, nrow(smoking)), type = "blshift")