# Plot Null Hypothesis Significance Tests

Illustrate graphically the most common Null Hypothesis Significance Testing procedures. More specifically, this package provides functions to plot Chi-Squared, F, t (one- and two-tailed) and z (one- and two-tailed) tests, by plotting the probability density under the null hypothesis as a function of the different test statistic values. Although highly flexible (color theme, fonts, etc.), only the minimal number of arguments (observed test statistic, degrees of freedom) are necessary for a clear and useful graph to be plotted, with the observed test statistic and the p value, as well as their corresponding value labels. The axes are automatically scaled to present the relevant part and the overall shape of the probability density function. This package is especially intended for education purposes, as it provides a helpful support to help explain the Null Hypothesis Significance Testing process, its use and/or shortcomings.

nhstplot is a simple and convenient package to represent graphically the most common Null Hypothesis Significance Tests (NHST).

One plot being worth 1000 words, it does this...

With a very minimal amount of (intuitive) coding (here plotftest(f = 4, dfnum = 3, dfdenom = 5), and even plotftest(4,3,5) works the same if you're in a hurry).

In other words, it plots the density functions of (z), (t), (F) and (\chi^2), adding a cutline at the observed statistic value, scaling it all conveniently, and plotting a label for the (p) value.

# How to use it

First, install the library with install.packages("nhstplot")

## Basic functions

'nhstplot' is composed of 4 functions, one for each major NHST test "family" :

• (\chi^2) tests (with the plotchisqtest function)
• (F) tests (with the plotftest function)
• (t) tests (with the plotttest function)
• (z) tests (with the plotztest function)

They all work quite the same (with minor differences, see the vignette for more info), with very few required arguments:

• The first required argument is the value of the test statistic (z), (t), (F) and (\chi^2)
• The other required arguments are the degrees of freedom (except for (z) of course)

That's it.

## One tailed tests

nhstplotis very flexible, but its strength is its helpful defaults and easy options.

For example, by default, when appropriate, two-tailed (z) and (t) tests are performed, but just add tails = "one" to get a one-tailed test that adapts to the sign of the test statistics:

## "Blanking"

To explain NHST in successive steps (and look good doing it), you may be tempted to "blank the plot" with blank = TRUE, which outputs the exact same graphs as before, but without the "cutting" part:

It's especially useful for any "step-by-step" explanation.

## Colors

And finally, if you don't like the default theme, I've added others, that can be called with theme, that can probably accomodate you (see the documentation or vignette for a list).

There are other options. See the vignette for further customizations.

## Disclaimer

This package is neither for or against NHST. It's meant to help explain the process, should you want to explain it. A lot of students (and scholars) have no choice but to read articles with (p) values, so they might as well have a better understanding of what it is and what it's not anyway, right?

## Bug reports

I will try to implement new features soon, so check that you have the newest version.

# nhstplot 1.0.1

Bug fixes: -Improved support for new ggplot2 version (horizontal alignment of the plot titles) -Gold and blue theme now works in Chi-squared function

Initial release

# Reference manual

install.packages("nhstplot")

1.1.0 by Nils Myszkowski, a year ago

Browse source code at https://github.com/cran/nhstplot

Authors: Nils Myszkowski [aut, cre]

Documentation:   PDF Manual