knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
In statistics, a $z$-score (standard score) is a signed value that indicates the number of standard deviations by which a data point is above or below the mean. A positive value indicates that the data point is above the mean. A negative value indicates that the data point is below the mean. It is calculated by subtracting the mean $\left(\mu\right)$ from the data point $\left(x\right)$ and dividing by the standard deviation $\left(\sigma = \sqrt{\sigma^2}\right)$.
\begin{equation} z = \frac{x - \mu}{\sigma} \end{equation}
The z
function performs this calculation.
set.seed(42) x <- rnorm(n = 1000, mean = 100, sd = 15) hist(x)
library(jeksterslabRds) std <- z(x = x, mu = 100, sigma = 15) hist(std, main = "Histogram of z")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.