Calculate summary statistics
Calculates summary statistics from outputs of generate()
or
hypothesize()
.
Learn more in vignette("infer")
.
calculate( x, stat = c("mean", "median", "sum", "sd", "prop", "count", "diff in means", "diff in medians", "diff in props", "Chisq", "F", "slope", "correlation", "t", "z", "ratio of props", "odds ratio"), order = NULL, ... )
x |
The output from |
stat |
A string giving the type of the statistic to calculate. Current
options include |
order |
A string vector of specifying the order in which the levels of
the explanatory variable should be ordered for subtraction, where |
... |
To pass options like |
A tibble containing a stat
column of calculated statistics.
In some cases, when bootstrapping with small samples, some generated bootstrap samples will have only one level of the explanatory variable present. For some test statistics, the calculated statistic in these cases will be NaN. The package will omit non-finite values from visualizations (with a warning) and raise an error in p-value calculations.
# calculate a null distribution of hours worked per week under # the null hypothesis that the mean is 40 gss %>% specify(response = hours) %>% hypothesize(null = "point", mu = 40) %>% generate(reps = 200, type = "bootstrap") %>% calculate(stat = "mean") # calculate a null distribution assuming independence between age # of respondent and whether they have a college degree gss %>% specify(age ~ college) %>% hypothesize(null = "independence") %>% generate(reps = 200, type = "permute") %>% calculate("diff in means", order = c("degree", "no degree")) # More in-depth explanation of how to use the infer package ## Not run: vignette("infer") ## End(Not run)
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.