Skip to main content

@psych/lib@1.24.0
Built and signed on GitHub Actions

A TypeScript library for math, statistics, and data analysis. Featured in psychological and educational research.

This package works with Cloudflare Workers, Node.js, Deno, Bun, Browsers
This package works with Cloudflare Workers
This package works with Node.js
This package works with Deno
This package works with Bun
This package works with Browsers
JSR Score
100%
Published
2 weeks ago (1.24.0)
c
AlphaRealiability

Homogeneity reliability (Cronbach's alpha)

T
BonferroniResult

ANOVA Post Hoc Test Result (Bonferroni)

f
bootstrapSample

Bootstrap sampling

T
BootstrapStat

Bootstrap statistic

f
bootstrapTest

Bootstrap test (calculate the confidence interval of mean)

f
c2p

Chi-square distribution chi-square value to p value The probability is from chi-square value to the right tail

f
centralize

Centralize the array

f
corr

Calculate the correlation coefficient of two arrays

c
CorrRealiability

Corralation between two variables

f
cov

Calculate the covariance of two arrays

f
f2p

F distribution f value to p value P value is the probability of f value to the right tail if twoside is false otherwise, it is the number above times 2

c
HalfRealiability

Half reliability

f
kurtosis

Calculate the kurtosis of numbers

c
KurtosisTest

Calculate the sample kurtosis and its z value and significance

f
max

Calculate the maximum value of numbers

f
mean

Calculate the mean of numbers

f
median

Calculate the median of numbers if the length of numbers is even, return the average of the two middle numbers

f
min

Calculate the minimum value of numbers

f
mode

Calculate the mode of numbers If there are multiple modes, return 3 * median - 2 * mean

c
OneSampleKSTest

One-sample Kolmogorov-Smirnov test for Normal distribution For small sample size, the p-value may not be accurate, please refer to rejected and decide for decision making

f
p2c

Chi-square distribution p value to chi-square value The probability is from chi-square value to the right tail

f
p2f

F distribution p value to f value P value is the probability of f value to the right tail if twoside is false otherwise, it is the number above times 2

f
p2t

Student's t-distribution p value to t value P value means the probability of the |t| to the right tail if twoside is false otherwise, P value means the probability of the -|t| to the left tail and |t| to the right tail

f
p2z

Convert p value to z value (the z value from the left tail to p)

c
PearsonCorrTest

Pearson correlation test Note: if you just want to calculate the correlation coefficient, use corr function directly

f
quantile

Calculate the quantile of numbers (interpolation method)

f
randomChi2

Generate a random number from chi-square distribution

f
randomF

Generate a random number from a f distribution

f
randomNormal

Generate a random number from a normal distribution

f
randomT

Generate a random number from a t distribution

f
range

Calculate the range of numbers

T
ScheffeResult

ANOVA Post Hoc Test Result (Scheffe)

f
sem

Calculate the standard error of the mean (SEM) of numbers

f
skewness

Calculate the skewness of numbers

c
SkewnessTest

Calculate the sample skewness and its z value and significance

f
sort

Sort numbers in ascending or descending order

T
SortAlgorithm

Available sort algorithms

f
sp

Calculate the sum of the product of two centered arrays (SP)

f
ss

Calculate the sum of squares (SS) of numbers

f
ssDiff

Calculate the sum of squares of the array difference

f
standardize

Standardize the array

f
std

Calculate the standard deviation of numbers

f
sum

Calculate the sum of two numbers

f
t2p

Student's t-distribution t value to p value P value is the probability of the |t| to the right tail if twoside is false otherwise, P value is the probability of the -|t| to the left tail and |t| to the right tail

T
TukeyResult

ANOVA Post Hoc Test Result (Tukey's HSD)

f
vari

Calculate the variance of numbers

f
z2p

Convert z value to p value (the probability from the left tail to z)