calculate_stat_models.Rd
Calculate function for set of models
calculate_stat_models(dataset, models, fun, ...)
Dataset to operate on.
Models to calculate for.
Function to calculate (i.e. t.test).
Parameters passed to fun
.
Data frame with results of function for each model.
library(ggplot2)
library(dplyr)
#>
#> Attaching package: ‘dplyr’
#> The following objects are masked from ‘package:stats’:
#>
#> filter, lag
#> The following objects are masked from ‘package:base’:
#>
#> intersect, setdiff, setequal, union
data(diamonds)
diamonds <- diamonds %>%
filter(color %in% c("D", "E"))
models <- list(
carat ~ color,
depth ~ color,
x ~ color
)
calculate_stat_models(diamonds, models, t.test)
#> # A tibble: 3 × 12
#> model func estimate estimate1 estimate2 statistic p.value parameter conf.low
#> <chr> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 carat… t.te… -7.19e-5 0.658 0.658 -0.0125 0.990 14793. -0.0113
#> 2 depth… t.te… 3.60e-2 61.7 61.7 1.60 0.109 14780. -0.00809
#> 3 x ~ c… t.te… 5.47e-3 5.42 5.41 0.365 0.715 14777. -0.0239
#> # … with 3 more variables: conf.high <dbl>, method <chr>, alternative <chr>