stats-calcs: Statistical calculations

stats-calcsR Documentation

Statistical calculations

Description

Various stastical calculations.

Usage

normalise(x, in_min = min(x, na.rm = TRUE), in_max = max(x, na.rm = TRUE))

scale_minmax(
  x,
  out_min,
  out_max,
  in_min = min(x, na.rm = TRUE),
  in_max = max(x, na.rm = TRUE)
)

max_z_given_n(n)

se(x, ...)

lm_r2(lm_mod, adjusted = FALSE)

mad(x, na.rm = TRUE)

log10(x)

sym_setdiff(a, b)

q1(x)

q3(pmf)

p_se(p_est, k)

Arguments

x

numeric vector

in_min

minimum possible value of input, defaults to min(x, na.rm = TRUE)

in_max

maximum possible value of input, defaults to max(x, na.rm = TRUE)

out_min

numeric scalar. Minimum value of scaled output.

out_max

numeric scalar. Maximum value of scaled output.

n

numeric scalar. sample size.

lm_mod

model output from stats::lm

adjusted

logical. Whether to return adjusted R (TRUE), or non-adjusted (FALSE). Defaults FALSE

p_est, k

estimated p value from Fisherian randomization inference from K iterations

Functions

  • normalise(): normalise vector to scale [0, 1]

  • scale_minmax(): normalise vector so that max = mx and min = mn

  • max_z_given_n(): Find Maximum z score given sample size n

  • se(): Calculate standard error of mean

  • lm_r2(): get r squared from stats::lm()

  • mad(): get median absolute deviation

  • log10(): Log(x, base = 10) wrapper

  • sym_setdiff(): symmetrical setdiff()

  • q1(): quantile wrapper for Q1

  • q3(): quantile wrapper for Q3

  • p_se(): estimate standard error of estimate p value from Fisherian randomization inference

See Also

https://www.tandfonline.com/doi/abs/10.1080/00031305.1988.10475530


WhiteJP/jpw documentation built on April 17, 2025, 5:47 a.m.