TeachHistDens {TeachHist} | R Documentation |
Build a Histogram with Regular and z-Value Axis
Description
The TeachHistDens function is the main function of this package. It generates a density histogram with two horizontal axis. One axis displays z-values the other one the dimension of the displayed variable. Relative Frequencies are shown in the midde of each bar.
Usage
TeachHistDens(
Mean = 0,
Sd = 1,
PlotData = dplyr::tibble(x = c(0)),
VLine1 = NULL,
VLine2 = NULL,
BinWidth = 1,
XAxisMax = 5,
PrintZAxis = TRUE,
AxisFontSize = 10,
LabelSize = 3,
PlotNormCurv = TRUE,
NOfSimData = 1000,
SeedValue = NULL,
PrintDensities = FALSE,
PrintRelFreq = TRUE
)
Arguments
Mean |
(default=0) Mean for simulated data (ignored if PlotData is set). |
Sd |
(default=1) Standard Deviation for simulated data (ignored if PlotData is set). |
PlotData |
If PlotData is set to a Tibble with one column, the histogram will be based on the provided data. If PlotData is not set, the data for the histogram will be simulated based on the settings for Mean and Sd. |
VLine1 |
(default= NA) A value for the simulated variable resulting in a vertical line at related x-axis position (can be se by user. E.g. lower boundary of conf intervall). |
VLine2 |
(default=NA) A value for the simulated variable resulting in a vertical line at related x-axis position (can be se by user. E.g. upper boundary of conf intervall). |
BinWidth |
(default=1) Bin width expressed in standard deviations. |
XAxisMax |
(default=5) X-axis ranges from negative to positive XAxisMax. If XAxisMax is not high enough, some of the simulated points might not be considered. |
PrintZAxis |
(default=TRUE) TRUE adds a second axis with z values. FALSE suppresses z axis and plots only axis with original values. |
AxisFontSize |
(default=10) Font size for axis labels. |
LabelSize |
(default=3) Size of the labels inside the diagram. |
PlotNormCurv |
(default=TRUE) If TRUE normal curve is plotted. |
NOfSimData |
(default=1000) Number of simulated data points. Higher NOfSimData results in better precision but possibly not all points are considered. |
SeedValue |
(default=NULL) Can be any integer and makes simulated points reproducible. |
PrintDensities |
(default=FALSE) Set PrintDensities=TRUE to print densities in the histogram. |
PrintRelFreq |
(default=TRUE) Set PrintRelFreq=FALSE to suppress the printing of relative frequencies in the histogram. |
Details
There are two ways to generate the histogram.: 1) Simulated Data: Provide Mean and Standard Deviation and the histogram will be generated based on simulated data. 2) Provide Data as a Data Frame (Tibble) Provide data (a Tibble with one column) and a histogram will be generated based on the provided data. Histogram Design: The Histogram will have two axis. One axis is for the simulated random variable the other is the related Z-value (deviation from mean in standard deviations). The user can also define up to two reference lines that will be plotted as vertical lines in the plot (see VLine1 and VLine2).
Value
Returns a histogram
Examples
TeachHistDens()
TeachHistDens(70,2)
MyTibbleWithOneColumn=dplyr::tibble(x=rnorm(2000,20,2))
TeachHistDens(PlotData=MyTibbleWithOneColumn)