Description Usage Arguments Details Value See Also Examples
Visualize the distribution of the simulation-based inferential statistics or the theoretical distribution (or both!).
1 2 3 4 5 6 7 8 9 | visualize(data, bins = 15, method = "simulation",
dens_color = "black", obs_stat = NULL, obs_stat_color = "red2",
pvalue_fill = "pink", direction = NULL, endpoints = NULL,
endpoints_color = "mediumaquamarine", ci_fill = "turquoise", ...)
visualise(data, bins = 15, method = "simulation",
dens_color = "black", obs_stat = NULL, obs_stat_color = "red2",
pvalue_fill = "pink", direction = NULL, endpoints = NULL,
endpoints_color = "mediumaquamarine", ci_fill = "turquoise", ...)
|
data |
The output from |
bins |
The number of bins in the histogram. |
method |
A string giving the method to display. Options are
|
dens_color |
A character or hex string specifying the color of the theoretical density curve. |
obs_stat |
A numeric value or 1x1 data frame corresponding to what the observed statistic is. Deprecated (see Details). |
obs_stat_color |
A character or hex string specifying the color of the observed statistic as a vertical line on the plot. Deprecated (see Details). |
pvalue_fill |
A character or hex string specifying the color to shade
the p-value. In previous versions of the package this was the |
direction |
A string specifying in which direction the shading should
occur. Options are |
endpoints |
A 2 element vector or a 1 x 2 data frame containing the lower and upper values to be plotted. Most useful for visualizing conference intervals. Deprecated (see Details). |
endpoints_color |
A character or hex string specifying the color of the observed statistic as a vertical line on the plot. Deprecated (see Details). |
ci_fill |
A character or hex string specifying the color to shade the confidence interval. Deprecated (see Details). |
... |
Other arguments passed along to {ggplot2} functions. |
In order to make visualization workflow more straightforward and
explicit visualize()
now only should be used to plot statistics directly.
That is why arguments not related to this task are deprecated and will be
removed in a future release of {infer}.
To add to plot information related to p-value use shade_p_value()
. To add
to plot information related to confidence interval use
shade_confidence_interval()
.
A ggplot object showing the simulation-based distribution as a histogram or bar graph. Also used to show the theoretical curves.
shade_p_value()
, shade_confidence_interval()
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | # Permutations to create a simulation-based null distribution for
# one numerical response and one categorical predictor
# using t statistic
mtcars %>%
dplyr::mutate(am = factor(am)) %>%
specify(mpg ~ am) %>% # alt: response = mpg, explanatory = am
hypothesize(null = "independence") %>%
generate(reps = 100, type = "permute") %>%
calculate(stat = "t", order = c("1", "0")) %>%
visualize(method = "simulation") #default method
# Theoretical t distribution for
# one numerical response and one categorical predictor
# using t statistic
mtcars %>%
dplyr::mutate(am = factor(am)) %>%
specify(mpg ~ am) %>% # alt: response = mpg, explanatory = am
hypothesize(null = "independence") %>%
# generate() is not needed since we are not doing simulation
calculate(stat = "t", order = c("1", "0")) %>%
visualize(method = "theoretical")
# Overlay theoretical distribution on top of randomized t-statistics
mtcars %>%
dplyr::mutate(am = factor(am)) %>%
specify(mpg ~ am) %>% # alt: response = mpg, explanatory = am
hypothesize(null = "independence") %>%
generate(reps = 100, type = "permute") %>%
calculate(stat = "t", order = c("1", "0")) %>%
visualize(method = "both")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.