Powered by AppSignal & Oban Pro

Mean and standard error: mean_se

notebooks/mean_se.livemd

Mean and standard error: mean_se

Mix.install([
  {:giggly, path: Path.join(__DIR__, "..")},
  {:kino, "~> 0.19"}
  ])

About this notebook

This notebook follows the examples on ggplot2's reference page for mean_se(), in the order the page gives them. Each example shows ggplot2's code first and then Giggly's. An example Giggly cannot draw yet keeps its ggplot2 code and names what it is waiting for, so the page is also a list of what remains.

mean_se() takes a numeric vector and returns a data frame of one row: the mean in y, and the mean minus and plus a multiple of the standard error, one by default, in ymin and ymax. It is made for stat_summary(). Giggly has it as the summary Giggly.Plot.stat_summary/3 draws unless given another (fun_data: :mean_se), not as a function of a list of values. Not in Giggly yet: mean_se().

The mean of random values

set.seed(1)
x <- rnorm(100)
mean_se(x)

With set.seed(1) fixing R's random numbers, rnorm(100) draws 100 values from a standard normal distribution, and mean_se() returns their mean and the mean one standard error either side. Not in Giggly yet: mean_se().