Skip to content

ErrorBar

Mojo struct 👭

ErrorBar

@memory_only
struct ErrorBar

How the uncertainty around an estimate is sized.

  • ErrorBar.none() – no interval.
  • ErrorBar.sd(k) – k sample standard deviations, the spread of the observations themselves.
  • ErrorBar.se(k) – k standard errors of the mean, the spread of the estimate.
  • ErrorBar.pi(level) – a percentile interval of the observations, e.g. 0.95 for the 2.5th to 97.5th percentile.
  • ErrorBar.ci(level) – a bootstrap confidence interval of the estimate: resample the group with replacement, re-estimate, take the percentile interval of those estimates. Needs a seed, which barplot() carries with a fixed default.

sd and se are symmetric about the estimate and closed-form; pi and ci are asymmetric and follow the data’s shape.

Fields

  • scale (Float64): k for sd/se, the confidence level in (0, 1) for pi/ci.

Implemented traits

AnyType, Copyable, Deinitable, ImplicitlyCopyable, Movable

Methods

__init__

fn def __init__(out self, kind: Int, scale: Float64)

Args:

  • kind (Int)
  • scale (Float64)
  • self (Self)

Returns:

Self

none

@staticmethod
fn def none() -> Self

Returns:

Self

sd

@staticmethod
fn def sd(k: Float64 = 1) -> Self

Args:

  • k (Float64)

Returns:

Self

se

@staticmethod
fn def se(k: Float64 = 1) -> Self

Args:

  • k (Float64)

Returns:

Self

pi

@staticmethod
fn def pi(level: Float64 = 0.94999999999999996) -> Self

Args:

  • level (Float64)

Returns:

Self

ci

@staticmethod
fn def ci(level: Float64 = 0.94999999999999996) -> Self

Args:

  • level (Float64)

Returns:

Self

is_none

fn def is_none(self) -> Bool

Args:

  • self (Self)

Returns:

Bool

is_bootstrap

fn def is_bootstrap(self) -> Bool

Args:

  • self (Self)

Returns:

Bool

label

fn def label(self) -> String

How the interval was made, for a caption.

Args:

  • self (Self)

Returns:

String