Skip to contents

Returns a data frame with one row per estimated coefficient, compatible with the broom idiom. For dynamic_beta fits (3-D BETA), returns one row per coefficient per period with a period column. Standard errors are posterior standard deviations; statistic is estimate / std.error.

Usage

# S3 method for class 'ame'
tidy(x, conf.int = TRUE, conf.level = 0.95, ...)

# S3 method for class 'lame'
tidy(x, conf.int = TRUE, conf.level = 0.95, ...)

Arguments

x

A fitted ame / lame object.

conf.int

Logical; include 95\ (conf.low, conf.high). Default TRUE.

conf.level

Confidence level for the interval. Default 0.95.

...

Ignored.

Value

Data frame with columns term, estimate, std.error, statistic, p.value, conf.low, conf.high, and (for dynamic_beta fits) period.

Details

Note on p.value. This column is included for broom compatibility but is not a classical test. It is a two-sided Normal approximation based on the posterior mean and marginal posterior standard deviation, matching the calculation in summary(fit). Use it as a compact signal that the marginal posterior is far from zero, and report it alongside the conf.low / conf.high credible interval. When sign certainty matters, compute it directly from x$BETA, for example mean(sign(BETA) == sign(mean(BETA))).

Loaded as an S3 method against generics::tidy when the generics package is available; works as tidy(fit) either way once broom is loaded.

Examples

# \donttest{
data(YX_bin_list)
fit <- lame(YX_bin_list$Y, YX_bin_list$X, family = "binary", R = 0,
            nscan = 100, burn = 20, odens = 5, verbose = FALSE)
#> Warning: `family` = "binary" but `Y` contains values other than 0/1.
#>  `Y` will be thresholded to `1 * (Y > 0)`; if you meant counts, use "poisson",
#>   or "ordinal"/"normal" as appropriate.
tidy(fit)
#> # A tibble: 4 × 7
#>   term      estimate std.error statistic  p.value conf.low conf.high
#>   <chr>        <dbl>     <dbl>     <dbl>    <dbl>    <dbl>     <dbl>
#> 1 intercept   0.0882    0.0295      2.99 2.77e- 3   0.0485     0.144
#> 2 X1_dyad     0.509     0.0631      8.07 6.66e-16   0.393      0.590
#> 3 X2_dyad     0.622     0.0790      7.87 3.55e-15   0.480      0.721
#> 4 X3_dyad     0.771     0.0959      8.04 8.88e-16   0.585      0.883
# }