Learn R Programming

WVPlots (version 1.3.7)

PlotDistDensityNormal: Plot an empirical density with the matching normal distribution

Description

Compares empirical data to a normal distribution with the same mean and standard deviation.

Usage

PlotDistDensityNormal(
  frm,
  xvar,
  title,
  ...,
  adjust = 0.5,
  curve_color = "lightgray",
  normal_color = "blue",
  mean_color = "blue",
  sd_color = "darkgray"
)

Arguments

frm

data frame to get values from

xvar

name of the independent (input or model) column in frame

title

title to place on plot

...

no unnamed argument, added to force named binding of later arguments.

adjust

passed to geom_density; controls smoothness of density plot

curve_color

color for empirical density curve

normal_color

color for theoretical matching normal

mean_color

color of mean line

sd_color

color for 1-standard deviation lines (can be NULL)

Details

Plots the empirical density, the theoretical matching normal, the mean value, and plus/minus one standard deviation from the mean.

See Also

Examples

Run this code

if (requireNamespace('data.table', quietly = TRUE)) {
	# don't multi-thread during CRAN checks
		data.table::setDTthreads(1)
}

set.seed(52523)
d <- data.frame(wt=100*rnorm(100))
PlotDistDensityNormal(d,'wt','example')

# # no sd lines
# PlotDistDensityNormal(d, 'wt', 'example', sd_color=NULL)

Run the code above in your browser using DataLab