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; it is a posterior summary, not a classical test: the two-sided Normal tail probability of the posterior mean over the marginal posterior standard deviation, matching summary(fit). The conf.low / conf.high columns are the credible interval. The posterior probability of the sign is available 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)
# chains = 1 keeps the example short; the default runs two chains and compares them
fit <- lame(lapply(YX_bin_list$Y, function(y) 1 * (y > 0)), YX_bin_list$X, family = "binary", R = 0,
            nscan = 100, burn = 20, odens = 5, verbose = FALSE, chains = 1)
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.116    0.0199      5.81 0.00000000626   0.0863     0.154
#> 2 X1_dyad      0.736    0.0209     35.2  0               0.701      0.773
#> 3 X2_dyad      0.897    0.0310     29.0  0               0.841      0.950
#> 4 X3_dyad      1.12     0.0334     33.4  0               1.05       1.17 
# }