plot_sampling_distribution: Plot the sampling distribution of a statistic.

View source: R/plot_sampling_distribution.R

plot_sampling_distributionR Documentation

Plot the sampling distribution of a statistic.

Description

Provides a wrapper for plotting a model for the sampling distribution of a parameter estimate in a linear model.

Usage

plot_sampling_distribution(
  estimates,
  parameter,
  show.confidence.interval = FALSE
)

Arguments

estimates

result of a call to estimate_parameters.

parameter

character string indicating for which parameter the modeled sampling distribution should be plotted. This should match the output of the "term" column in estimate_parameters output. If missing (default), the model for the sampling distribution of the first term is plotted.

show.confidence.interval

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

Details

The estimate_parameters function returns an attribute that contains a random sample from the sampling distribution of the parameter estimate. This is extracted and used to construct a graphic summarizing this distribution.

Value

ggplot2 object.

See Also

estimate_parameters

Examples

fit <- lm(mpg ~ hp, data = mtcars)

samp_distn <- estimate_parameters(fit,
  confidence.level = 0.95,
  assume.constant.variance = TRUE,
  assume.normality = FALSE)

plot_sampling_distribution(samp_distn,
  show.confidence.interval = TRUE)


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