Extract coefficients from a flexyBayes fit
Source:R/methods.R, R/ordinal_methods.R
coef.flexybayes.RdReturns the fixed effects by default, and the random-effect
predictions or the unobserved design cells on request. An ASReml user
reaches for coef(fit)$random. The equivalent here is
coef(fit, what = "random"), which is what ranef() calls.
Arguments
- object
A fitted
flexybayesobject of any backend.- what
Which part of the fit to return.
"fixed"(the default) is the fixed-effect posterior means."random"is one data frame per grouping factor, with the columnsgroup,level,estimate,std.error,conf.lowandconf.high. A grouping factor carrying more than one effect names the effect inlevel."missing"is the table of unobserved design cells, in the columnsrow,estimate,std.error,conf.low,conf.highplus any design index variables the fit recorded."all"is the named list of all three. On a fit withfamily = "cumulative"or"cratio","thresholds"is the posterior means of the thresholds, namedthreshold[<lower>|<upper>], and"all"carries them as a fourth element.- ...
Ignored, present for compatibility with the generic.
Value
For what = "fixed", a named numeric vector of the fixed
effects' posterior means on the treatment-contrast basis, named for
the design-matrix columns, empty when the model carries no fixed
effects. For "random", a named list of data frames, empty when the
model carries no random terms. For "missing", a data frame with
zero rows when every response was observed. For "all", a list with
the elements fixed, random and missing.
Details
The default is the historical return, a named numeric vector of the
fixed effects, so every caller that treats coef(fit) as a numeric
vector keeps working, including the emmeans and
marginaleffects seams, predict(), vcov() and the tidiers.
See also
ranef() for the random-effect table on its own,
summary.flexybayes() whose random and missing slots are the
same two objects, and nobs() for the design and observed counts.