
Extract point estimates and intervals as base R objects
Source:R/extractors.R
interactmeta-extractors.RdStandard accessors for the effect objects returned by modifiers(),
interactions(), combined() and shrinkage(), and for the pooled
information fraction returned by ifrac() on a fit. They return plain
numeric vectors, numeric matrices, or data.frames, so no tibble
manipulation is needed.
Usage
# S3 method for class 'interactmeta_subgroup_effects'
coef(object, type = NULL, ...)
# S3 method for class 'interactmeta_interaction_effects'
coef(object, type = NULL, ...)
# S3 method for class 'interactmeta_combined_effect'
coef(object, type = NULL, ...)
# S3 method for class 'interactmeta_construction_subgroups'
coef(object, type = NULL, ...)
# S3 method for class 'interactmeta_construction_interaction'
coef(object, type = NULL, ...)
# S3 method for class 'interactmeta_subgroup_effects'
confint(object, parm, level = NULL, type = NULL, ...)
# S3 method for class 'interactmeta_interaction_effects'
confint(object, parm, level = NULL, type = NULL, ...)
# S3 method for class 'interactmeta_combined_effect'
confint(object, parm, level = NULL, type = NULL, ...)
# S3 method for class 'interactmeta_construction_subgroups'
confint(object, parm, level = NULL, type = NULL, ...)
# S3 method for class 'interactmeta_construction_interaction'
confint(object, parm, level = NULL, type = NULL, ...)
# S3 method for class 'interactmeta_subgroup_effects'
as.data.frame(x, row.names = NULL, optional = FALSE, ...)
# S3 method for class 'interactmeta_interaction_effects'
as.data.frame(x, row.names = NULL, optional = FALSE, ...)
# S3 method for class 'interactmeta_combined_effect'
as.data.frame(x, row.names = NULL, optional = FALSE, ...)
# S3 method for class 'interactmeta_construction_subgroups'
as.data.frame(x, row.names = NULL, optional = FALSE, ...)
# S3 method for class 'interactmeta_construction_interaction'
as.data.frame(x, row.names = NULL, optional = FALSE, ...)
# S3 method for class 'interactmeta_overall_ifrac'
coef(object, ...)
# S3 method for class 'interactmeta_overall_ifrac'
confint(object, parm, level = NULL, ...)Arguments
- object, x
An effect object from
modifiers(),interactions(),combined()orshrinkage(), or (forcoef()/ interval accessors) a pooled information fraction fromifrac()on a fit.- type
Optional subset of the
typecolumn ("Overall","Prediction","Shrinkage").NULL(default) keeps all rows.- ...
Ignored.
- parm
Optional names or indices of the coefficients to keep.
- level
Coverage probability.
NULL(default) uses the object'sprob. For effect objects a different value is an error.- row.names, optional
Passed to
base::as.data.frame()conventions;row.namesreplaces the default integer row names.
Value
coef(): named numeric vector. Names are the row label (modifier level, interaction contrast, or"Combined"), prefixed bytrialfor trial-specific shrinkage rows, and suffixed by":<type>"only when the object holds more than onetype(e.g."Higher:Overall").credint()/stats::confint(): numeric matrix with columnslowerandupper, one row per coefficient (same names ascoef()), with attributeprob.as.data.frame(): the summary table as a plaindata.frame.
Details
What the numbers are. coef() returns the estimate column of the
stored summary:
Bayesian CAMS: the posterior median (on the reporting scale; with
exponentiate = TRUEthis is the exponentiated median). Posterior means are inas.data.frame(x)$mean.Frequentist CAMS (
method = "REML"/"ML", metafor) and DA / AD / SWADA: the fitted point estimate (equal tomean).
Interval accessors are inference-specific aliases with the same API:
credint() for Bayesian objects (credible intervals; stored lci / uci
at x$prob, following fit$interval.type, default "central") and
stats::confint() for frequentist objects (confidence intervals).
Calling the wrong function stops with a pointer to the other name.
"Prediction" rows are intervals for the effect in a new trial. For effect
objects the intervals are not recomputed; request another coverage with e.g.
modifiers(fit, prob = 0.9).
For the pooled information fraction (interactmeta_overall_ifrac),
coef() is the posterior median of the DIRECT-weighted pooled IF
(Bayesian) or the plug-in value at the fitted heterogeneity (frequentist;
frequentist stats::confint() may return NA bounds). credint() and
stats::confint() on this object accept any level on Bayesian fits; use
the matching accessor for the fit's inference mode.
For Bayesian fits, default ifrac(fit) returns one pooled IF per DIRECT
support row (tau_sampling = "grid"). Use ifrac(fit, tau_sampling = "posterior") for marginal-\(\tau\) Monte Carlo draws; coef() or
attr(x, "summary") for summaries.
Examples
if (FALSE) { # \dontrun{
fit <- cams(as.data.frame(edss), reference = "Higher", method = "REML")
coef(modifiers(fit)) # c("Higher:Overall" = ..., ...)
coef(modifiers(fit, type = "Overall")) # c(Higher = ..., Lower = ...)
fit_b <- cams(sub, method = "Bayesian")
credint(interactions(fit_b, type = "Overall"))
fit_f <- cams(sub, method = "REML")
confint(modifiers(fit_f, type = "Overall"))
coef(interactions(fit, reference = "Lower")) # sign-flipped contrast
coef(combined(fit, type = "Overall", exponentiate = TRUE))
coef(ifrac(fit)) # pooled information fraction
as.data.frame(modifiers(fit)) # plain data.frame
} # }