API Docs for: 0.99.4
Show:

# JXG.Math.Statistics Class

Functions for mathematical statistics. Most functions are like in the statistics package R.

## Methods

### `abs`

(
• `arr`
)

Determines the absolute value of every given value.

#### Parameters:

• `arr`

:

### `add`

(
• `arr1`
• `arr2`
)

Adds up two (sequences of) values. If one value is an array and the other one is a number the number is added to every element of the array. If two arrays are given and the lengths don't match the shortest length is taken.

#### Parameters:

• `arr1`
• `arr2`

:

### `div`

(
• `arr1`
• `arr2`
)

Divides two (sequences of) values. If two arrays are given and the lengths don't match the shortest length is taken.

#### Parameters:

• `arr1`

Dividend

• `arr2`

Divisor

:

() deprecated

### `max`

(
• `arr`
)

Extracts the maximum value from the array.

#### Parameters:

• `arr` Array

#### Returns:

Number:

The highest number from the array. It returns NaN if not every element could be interpreted as a number and -Infinity if an empty array is given or no element could be interpreted as a number.

### `mean`

(
• `arr`
)

Determines the mean value of the values given in an array.

#### Parameters:

• `arr` Array

### `median`

(
• `arr`
)

The median of a finite set of values is the value that divides the set into two equal sized subsets.

#### Parameters:

• `arr` Array

The set of values.

### `min`

(
• `arr`
)

Extracts the minimum value from the array.

#### Parameters:

• `arr` Array

#### Returns:

Number:

The lowest number from the array. It returns NaN if not every element could be interpreted as a number and Infinity if an empty array is given or no element could be interpreted as a number.

### `mod`

(
• `arr1`
• `arr2`
• `[math=false]`
)

Divides two (sequences of) values and returns the remainder. If two arrays are given and the lengths don't match the shortest length is taken.

#### Parameters:

• `arr1`

Dividend

• `arr2`

Divisor

• `[math=false]` Boolean optional

Mathematical mod or symmetric mod? Default is symmetric, the JavaScript % operator.

:

### `multiply`

(
• `arr1`
• `arr2`
)

Multiplies two (sequences of) values. If one value is an array and the other one is a number the number is multiplied to every element of the array. If two arrays are given and the lengths don't match the shortest length is taken.

#### Parameters:

• `arr1`
• `arr2`

:

### `prod`

(
• `arr`
)

Multiplies all elements of the given array.

#### Parameters:

• `arr` Array

An array of numbers.

### `range`

(
• `arr`
)

Determines the lowest and the highest value from the given array.

#### Parameters:

• `arr` Array

#### Returns:

Array:

The minimum value as the first and the maximum value as the second value.

### `sd`

(
• `arr`
)

Determines the standard deviation which shows how much variation there is from the average value of a set of numbers.

#### Parameters:

• `arr` Array

### `subtract`

(
• `arr1`
• `arr2`
)

Subtracts two (sequences of) values. If two arrays are given and the lengths don't match the shortest length is taken.

#### Parameters:

• `arr1`

Minuend

• `arr2`

Subtrahend

:

### `sum`

(
• `arr`
)

Sums up all elements of the given array.

#### Parameters:

• `arr` Array

An array of numbers.

### `TheilSenRegression`

(
• `coords`
)

The Theil-Sen estimator can be used to determine a more robust linear regression of a set of sample points than least squares regression in undefined.

#### Parameters:

• `coords` Array

#### Returns:

Array:

The stdform of the regression line.

### `variance`

(
• `arr`
)

Bias-corrected sample variance. A variance is a measure of how far a set of numbers are spread out from each other.

#### Parameters:

• `arr` Array

### `weightedMean`

(
• `arr`
• `w`
)

Weighted mean value is basically the same as JXG.Math.Statistics#mean but here the values are weighted, i.e. multiplied with another value called weight. The weight values are given as a second array with the same length as the value array..

#### Parameters:

• `arr` Array

Set of alues.

• `w` Array

Weight values.

#### Throws:

Error:

If the dimensions of the arrays don't match.