This function allows to inspect results of the specification curves by returning a comparatively simple summary of the results. This summary can be produced for various specific analytical choices and customized summary functions.

summarise_specs(
  df,
  ...,
  var = .data$estimate,
  stats = list(median = median, mad = mad, min = min, max = max, q25 = function(x)
    quantile(x, prob = 0.25), q75 = function(x) quantile(x, prob = 0.75))
)

Arguments

df

a data frame resulting from run_specs().

...

one or more grouping variables (e.g., subsets, controls,...) that denote the available analytical choices.

var

which variable should be evaluated? Defaults to estimate (the effect sizes computed by run_specs()).

stats

named vector or named list of summary functions (individually defined summary functions can included). If it is not named, placeholders (e.g., "fn1") will be used as column names.

Value

a tibble.

See also

plot_summary() to visually investigate the affect of analytical choices.

Examples

# Run specification curve analysis results <- run_specs(df = example_data, y = c("y1", "y2"), x = c("x1", "x2"), model = c("lm"), controls = c("c1", "c2"), subsets = list(group1 = unique(example_data$group1), group2 = unique(example_data$group2))) # overall summary summarise_specs(results)
#> # A tibble: 1 x 7 #> median mad min max q25 q75 obs #> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> #> 1 3.59 4.56 -2.05 9.58 1.03 7.63 123
# Summary of specific analytical choices summarise_specs(results, # data frame x, y) # analytical choices
#> # A tibble: 4 x 9 #> # Groups: x [2] #> x y median mad min max q25 q75 obs #> <chr> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> #> 1 x1 y1 6.52 2.01 3.49 9.28 5.46 8.22 123 #> 2 x1 y2 0.498 1.96 -2.05 3.67 -0.568 1.60 123 #> 3 x2 y1 7.80 0.669 5.89 9.58 7.33 8.21 123 #> 4 x2 y2 1.29 0.799 -0.258 2.91 0.823 1.80 123
# Summary of other parameters across several analytical choices summarise_specs(results, subsets, controls, var = p.value, stats = list(median = median, min = min, max = max))
#> # A tibble: 48 x 6 #> # Groups: subsets [12] #> subsets controls median min max obs #> <chr> <chr> <dbl> <dbl> <dbl> <dbl> #> 1 all c1 0.00000536 9.94e-47 0.792 500 #> 2 all c1 + c2 0.00000184 5.08e-89 0.838 500 #> 3 all c2 0.0000559 8.09e-63 0.377 500 #> 4 all no covariates 0.0000309 8.62e-40 0.252 500 #> 5 group1 = 0 c1 0.0000286 6.90e-35 0.921 250 #> 6 group1 = 0 c1 + c2 0.00131 1.20e-57 0.544 250 #> 7 group1 = 0 c2 0.0817 5.38e-33 0.994 250 #> 8 group1 = 0 no covariates 0.00528 2.57e-24 0.568 250 #> 9 group1 = 0 & group2 = A c1 0.00258 3.15e- 8 0.0235 72 #> 10 group1 = 0 & group2 = A c1 + c2 0.000222 6.98e-16 0.00253 72 #> # … with 38 more rows
# Unnamed vector instead of named list passed to `stats` summarise_specs(results, controls, stats = c(mean = mean, median = median))
#> # A tibble: 4 x 4 #> controls mean median obs #> <chr> <dbl> <dbl> <dbl> #> 1 c1 4.07 3.16 123 #> 2 c1 + c2 3.79 3.16 123 #> 3 c2 4.08 3.79 123 #> 4 no covariates 4.38 3.95 123