plot_null_distribution: Plot the null distribution of a test statistic.

View source: R/plot_null_distribution.R

plot_null_distributionR Documentation

Plot the null distribution of a test statistic.

Description

Provides a wrapper for plotting a model for the null distribution of a test statistic comparing two linear models.

Usage

plot_null_distribution(statistics, show.pvalue = FALSE)

Arguments

statistics

result of a call to compare_models.

show.pvalue

boolean indicating whether the p-value region should be drawn on the graphic. If TRUE, the region is drawn; if FALSE (default), the region is not drawn.

Details

The compare_models function returns an attribute that contains a random sample from the null distribution of the test statistic. This is extracted and used to construct a graphic summarizing this distribution.

Value

ggplot2 object.

See Also

compare_models

Examples

fit1 <- lm(mpg ~ hp, data = mtcars)
fit0 <- lm(mpg ~ 1, data = mtcars)

null_distn <- compare_models(fit1, fit0,
  assume.constant.variance = TRUE,
  assume.normality = FALSE)

plot_null_distribution(null_distn,
  show.pvalue = TRUE)


reyesem/IntroAnalysis documentation built on March 29, 2025, 3:29 p.m.