Nonlinear Programming Methods

# npm

## statkit

0.2.0 • Public • Published

# statkit

A statistics toolkit for javascript.

# Usage

Install using npm:

``````npm install statkit
``````

Fit a linear regression model using MCMC:

Calculate a confidence interval for a correlation using the bootstrap method:

Perform a linear regression on the first data set in Anscombe's quartet:

# Functions

• `min(a)` - Minimum
• `max(a)` - Maximum
• `range(a)` - Range
• `quantile(a)` - Quantile
• `median(a)` - Median
• `iqr(a)` - Interquartile range
• `mean(a)` - Mean
• `gmean(a)` - Geometric mean
• `hmean(a)` - Harmonic mean
• `var(a)` - Variance
• `std(a)` - Standard deviation
• `skew(a)` - Skewness
• `kurt(a)` - Kurtosis
• `corr(x, y)` - Correlation between x and y
• `entropy(p)` - Entropy
• `kldiv(p, q)` - Kullback–Leibler divergence
• `shuffle(a)` - Shuffle using the Fisher–Yates shuffle
• `sample(a)` - Sample with replacement
• `boot(nboot, bootfun, data...)` - Bootstrap the bootfun statistic
• `bootci(nboot, bootfun, data...)` - Calculate bootstrap confidence intervals using the normal model
• `randn()` - Draw random sample from the standard normal distribution using the Marsaglia polar method
• `normcdf(x)` - Normal cumulative distribution function
• `norminv(p)` - Normal inverse cumulative distribution function
• `lufactor(A, n)` - Compute pivoted LU decomposition
• `lusolve(LU, p, b)` - Solve `Ax=b` given the LU factorization of `A`
• `qrfactor(m, n, A)` - Compute QR factorization of A
• `qrsolve(m, n, QR, tau, b)` - Solve the least squares problem `min ||Ax = b||` using QR factorization `QR` of `A`
• `lstsq(m, n, A, b)` - Solve the least squares problem `min ||Ax = b||`
• `metropolis(lnpost, p, iterations, scale, burn, thin)` - Sample from `lnpost` starting at `p` using the Metropolis-Hastings algorithm

# Credits

(c) 2015 Erik Rigtorp erik@rigtorp.se. MIT License

## Keywords

### Install

`npm i statkit`

### Repository

github.com/rigtorp/statkit

### Homepage

github.com/rigtorp/statkit

28

0.2.0