plotztest | R Documentation |
This function plots the density probability distribution of a z statistic, with appropriate vertical cutlines at the z value. The p-value and the observed z value are plotted. Although largely customizable, only one argument is required (the observed z statistic) for a two-tailed z test. The optional argument tails = "one"
plots a one-tailed test plot (the tail is on the left or right, depending on the sign of the z statistic).
plotztest(
z,
tails = "two",
blank = FALSE,
xmax = "auto",
title = "z test",
xlabel = "z",
ylabel = "Density of probability\nunder the null hypothesis",
fontfamily = "serif",
colormiddle = "aliceblue",
colorsides = "firebrick3",
colormiddlecurve = "black",
colorsidescurve = "black",
colorcut = "black",
colorplabel = colorsides,
theme = "default",
signifdigitsz = 3,
curvelinesize = 0.4,
cutlinesize = curvelinesize,
p_value_position = "auto"
)
z |
A numeric value indicating the observed z statistic. |
tails |
A character that indicates whether to plot a one ( |
blank |
A logical that indicates whether to hide ( |
xmax |
A numeric including the maximum for the x-axis. Defaults to |
title |
A character or expression indicating a custom title for the plot (optional). |
xlabel |
A character or expression indicating a custom title for the x axis (optional). |
ylabel |
A character or expression indicating a custom title for the y axis (optional). |
fontfamily |
A character indicating the font family of all the titles and labels (e.g. |
colormiddle |
A character indicating the color for the "middle" area under the curve (optional). |
colorsides |
A character indicating the color for the "side(s)" area(s) under the curve (optional). |
colormiddlecurve |
A character indicating the color for the "middle" part of the curve (optional). |
colorsidescurve |
A character indicating the color for the "side(s)" part of the curve (optional). |
colorcut |
A character indicating the color for the cut line at the observed test statistic (optional). |
colorplabel |
A character indicating the color for the label of the p-value (optional). By default, for color consistency, this color is the same as color of |
theme |
A character indicating one of the predefined color themes. The themes are |
signifdigitsz |
A numeric indicating the number of desired significant figures reported for the z label (optional). |
curvelinesize |
A numeric indicating the size of the curve line (optional). |
cutlinesize |
A numeric indicating the size of the cut line(s) (optional). By default, the size of the curve line is used. |
p_value_position |
A numeric vector of length 2, indicating the x and y coordinates of the p-value label. By default, the position is set to |
Returns a plot with the density of probability of z under the null hypothesis, annotated with the observed z statistic and the p-value.
Nils Myszkowski <nmyszkowski@pace.edu>
#Making a z test plot with a z value of 2.
plotztest(2)
#The same plot without the z or p value
plotztest(2, blank = TRUE)
#Plotting a one-tailed test using the "tails" parameter.
plotztest(z = 2, tails = "one")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.