Skip to contents

Returns a data frame with one row per regression coefficient, compatible with the broom idiom, so that ALS fits compose with modelsummary / kableExtra pipelines next to MCMC fits. Standard errors come from the bootstrap object attached to x$bootstrap when present (preferred, fully propagated), and otherwise from vcov.ame_als, the Laplace covariance of the empirical-Bayes fit. statistic is estimate / std.error; p.value is the Normal-approximation two-sided tail \(2(1 - \Phi(|z|))\) from the bootstrap or Laplace standard error. It is a Wald-style summary of the empirical-Bayes fit, not a posterior probability.

Usage

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

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

Arguments

x

A fitted ame_als / lame_als object.

conf.int

Logical; include conf.low / conf.high columns. Default TRUE.

conf.level

Confidence level. Default 0.95.

...

Passed to vcov.ame_als.

Value

Data frame with columns term, estimate, std.error, statistic, p.value, conf.low, conf.high, plus a se_source column recording "bootstrap" or "laplace" (the Laplace covariance, which covers every coefficient, node-covariate coefficients included).

Details

One row is returned for every regression coefficient of coef(fit): the intercept, the dyadic covariates and the node covariates. Additive (a, b) and multiplicative (U, V) parameters are not included; their posterior standard deviations are fit$a_sd, fit$b_sd, fit$U_sd and fit$V_sd.

Examples

# \donttest{
data(YX_nrm)
fit <- ame_als(Y = YX_nrm$Y, Xdyad = YX_nrm$X[, , 2:3],
               family = "normal", R = 1, verbose = FALSE)
tidy(fit)
#> # A tibble: 3 × 8
#>   term        estimate std.error statistic p.value conf.low conf.high se_source
#>   <chr>          <dbl>     <dbl>     <dbl>   <dbl>    <dbl>     <dbl> <chr>    
#> 1 intercept    -2.30      0.117    -19.6     0       -2.53     -2.07  laplace  
#> 2 rgpa_dyad    -0.0686    0.0899    -0.762   0.446   -0.245     0.108 laplace  
#> 3 rsmoke_dyad   0.0622    0.120      0.519   0.604   -0.173     0.297 laplace  
# }