If you are looking for the code (JavaScript syntax) we use, you can visit our official GitHub page at github.com/statistiku for more information :)
Basic Algorithms
Since Statistiku has capability to weight the data, we will explain the algorithms in the form of weighted formulas. If you want to apply the formulas for unweighted data, you can set 1s as the weight.
Notation | Description |
---|---|
`n` | Total records (items) |
`X_i` | Value of `i`th item of `X` |
`Y_i` | Value of `i`th item of `Y` |
`w_i` | Weight of `i`th item |
`N` | Total of frequency |
-
TOTAL OF FREQUENCY
`N = \sum_{i=1}^n w_i`
-
SUM
`\text{Sum of} \ X = \sum_{i=1}^n w_i X_i`
-
SUM SQUARE
`\text{Sum square of} \ X = \sum_{i=1}^n w_i X_i^2`
-
MEAN
`\barX = (\sum_{i=1}^n w_i X_i) / N`
-
GEOMETRIC MEAN
`\barX_\text{geom} = \prod_{i=1}^n X_i^(w_i/N)`
-
SUM SQUARED TOTAL
`\text{SST} = \sum_{i=1}^n w_i (X_i - \barX)^2`
-
VARIANCE
Variance of sample:
`\text{VAR} = \text{SST} / (N-1)`
Variance of population:
`\text{VAR}_p = \text{SST} / N`
-
STANDARD DEVIATION
Standard Deviation of sample:
`\text{SD} = \sqrt{\text{VAR}}`
Standard Deviation of population:
`\text{SD}_p = \sqrt{\text{VAR}_p}`
-
COVARIANCE
Covariance of sample:
`\text{COV} = {\sum_{i=1}^n w_i (X_i - \barX) (Y_i - \barY)} / {N-1}`
Covariance of population:
`\text{COV}_p = {\sum_{i=1}^n w_i (X_i - \barX) (Y_i - \barY)} / N`