dependent_sample_vis: Dependent sample scatter plot

View source: R/dependent_sample_vis.R

dependent_sample_visR Documentation

Dependent sample scatter plot

Description

Dependent sample scatter plot

Usage

dependent_sample_vis(
  df,
  x = names(df)[1],
  y = names(df)[2],
  test = "norm",
  conf_level = 0.95,
  height_multiplier = 1.5 * diff(range(df[, x], na.rm = TRUE)),
  plot_mean = TRUE,
  plot_unit_line = TRUE,
  plot_projections = TRUE,
  plot_differences = TRUE,
  plot_ci = TRUE,
  plot_ci_lines = FALSE,
  plot_samp_dist = TRUE
)

Arguments

df

the data.frame containing the data.

x

the name of the column for the x-axis.

y

the name of the column for the y-axis.

test

whether to use the normal distribution (norm) or t-distribution (t).

conf_level

the confidence level for the null hypothesis test.

height_multiplier

a multiplier applied to the sampling distribution to increase the height.

plot_mean

whether to plot a line for the mean difference.

plot_unit_line

whether to plot the line y = x.

plot_projections

whether to plot lines connecting the raw data points to a line perpendicular to the unit line representing the distribution of differences.

plot_differences

whether to plot points on aline perpendicular to the unit line representing the distribution of differences.

plot_ci

whether to plot a confidence interval.

plot_ci_lines

whether to plot to lines corresponding to the confidence interval.

plot_samp_dist

whether to plot the sampling distribution (normal or t depending on the test parameter).

Value

a ggplot2 expression.

Examples

data(blood_lead, package = 'granova')
dependent_sample_vis(
	   df = blood_lead,
	   test = 'norm', # or 't'
	   conf_level = 0.95,
	   plot_mean = TRUE,
	   plot_unit_line = TRUE,
	   plot_projections = TRUE,
	   plot_differences = TRUE,
	   plot_ci = TRUE,
	   plot_ci_lines = FALSE,
	   plot_samp_dist = TRUE
)

jbryer/VisualStats documentation built on Feb. 27, 2025, 6:19 p.m.