# JSXGraph 1.7.0 Reference

## JavaScript must be enabled in order for you to use JSXGraph and JSXGraph reference. However, it seems JavaScript is either disabled or not supported by your browser.

Class Index | File Index

Elements

Classes

- _global_
- Angle
- Arc
- Arrow
- Arrowparallel
- Axis
- Bisector
- Bisectorlines
- Boxplot
- Button
- Cardinalspline
- Chart
- Checkbox
- Circle
- Circumcenter
- Circumcircle
- CircumcircleArc
- CircumcircleSector
- Comb
- Conic
- Curve
- Curve3D
- CurveDifference
- CurveIntersection
- CurveUnion
- Derivative
- Ellipse
- ForeignObject
- Functiongraph
- Functiongraph3D
- Glider
- Grid
- Group
- Hatch
- Hyperbola
- Image
- ImplicitCurve
- Incenter
- Incircle
- Inequality
- Input
- Integral
- Intersection
- JXG
- JXG.AbstractRenderer
- JXG.Board
- JXG.Board.infobox
- JXG.C
- JXG.CA
- JXG.CanvasRenderer
- JXG.Chart
- JXG.Circle
- JXG.Complex
- JXG.Composition
- JXG.Coords
- JXG.CoordsElement
- JXG.Curve
- JXG.Curve3D
- JXG.Dump
- JXG.EventEmitter
- JXG.Expect
- JXG.ForeignObject
- JXG.GeometryElement
- JXG.GeometryElement3D
- JXG.GeonextParser
- JXG.Group
- JXG.Image
- JXG.JessieCode
- JXG.JSXGraph
- JXG.Legend
- JXG.Line
- JXG.Line3D
- JXG.Math
- JXG.Math.BoxQuadtree
- JXG.Math.Clip
- JXG.Math.Extrapolate
- JXG.Math.Geometry
- JXG.Math.ImplicitPlot
- JXG.Math.IntervalArithmetic
- JXG.Math.Metapost
- JXG.Math.Nlp
- JXG.Math.Numerics
- JXG.Math.Plot
- JXG.Math.Poly
- JXG.Math.Poly.Monomial
- JXG.Math.Poly.Polynomial
- JXG.Math.Poly.Ring
- JXG.Math.ProbFuncs
- JXG.Math.Quadtree
- JXG.Math.Statistics
- JXG.Math.Symbolic
- JXG.NoRenderer
- JXG.Options
- JXG.Plane3D
- JXG.Point
- JXG.Point3D
- JXG.Polygon
- JXG.PrefixParser
- JXG.Server
- JXG.Server.modules
- JXG.Surface3D
- JXG.SVGRenderer
- JXG.Text
- JXG.Ticks
- JXG.Transformation
- JXG.Turtle
- JXG.Util
- JXG.Util.Base64
- JXG.Util.Unzip
- JXG.Util.UTF8
- JXG.View3D
- JXG.VMLRenderer
- JXG.XML
- Label
- Legend
- Line
- Line3D
- Locus
- MajorArc
- MajorSector
- Measurement
- Metapostspline
- Midpoint
- MinorArc
- MinorSector
- mirrorelement
- Mirrorpoint
- NonReflexAngle
- Normal
- Orthogonalprojection
- OtherIntersection
- Parabola
- Parallel
- Parallelogram
- Parallelpoint
- ParametricSurface3D
- Perpendicular
- PerpendicularPoint
- PerpendicularSegment
- Point
- Point3D
- PolarLine
- PolePoint
- Polygon
- PolygonalChain
- RadicalAxis
- Reflection
- ReflexAngle
- RegularPolygon
- Riemannsum
- Sector
- Segment
- Semicircle
- Slider
- Slopefield
- Slopetriangle
- Smartlabel
- Spline
- Stepfunction
- Tangent
- Tapemeasure
- Text
- Ticks
- Tracecurve
- Transformation
- Turtle
- Vectorfield
- Vectorfield3D
- View3D

# Namespace JXG.Math.Statistics

↳ JXG.Math.Statistics

Defined in: statistics.js.

Namespace Summary
Constructor Attributes | Constructor Name and Description
--- | ---
| JXG.Math.Statistics Functions for mathematical statistics.

Method Summary
Method Attributes | Method Name and Description
--- | ---
<static> | JXG.Math.Statistics.abs(arr) Determines the absolute value of every given value.
<static> | JXG.Math.Statistics.add(arr1, arr2) Adds up two (sequences of) values.
<static> | JXG.Math.Statistics.div(arr1, arr2) Divides two (sequences of) values.
<static> <deprecated> | JXG.Math.Statistics.divide()
<static> | JXG.Math.Statistics.generateGaussian(mean, stdDev) Generate values of a standard normal random variable with the Marsaglia polar method, see https://en.wikipedia.org/wiki/Marsaglia_polar_method .
<static> | JXG.Math.Statistics.max(arr) Extracts the maximum value from the array.
<static> | JXG.Math.Statistics.mean(arr) Determines the mean value of the values given in an array.
<static> | JXG.Math.Statistics.median(arr) The median of a finite set of values is the value that divides the set into two equal sized subsets.
<static> | JXG.Math.Statistics.min(arr) Extracts the minimum value from the array.
<static> | JXG.Math.Statistics.mod(arr1, arr2, math) Divides two (sequences of) values and returns the remainder.
<static> | JXG.Math.Statistics.multiply(arr1, arr2) Multiplies two (sequences of) values.
<static> | JXG.Math.Statistics.percentile(arr, percentile) The P-th percentile ( 0 < P ≤ 100 ) of a list of N ordered values (sorted from least to greatest) is the smallest value in the list such that no more than P percent of the data is strictly less than the value and at least P percent of the data is less than or equal to that value.
<static> | JXG.Math.Statistics.prod(arr) Multiplies all elements of the given array.
<static> | JXG.Math.Statistics.range(arr) Determines the lowest and the highest value from the given array.
<static> | JXG.Math.Statistics.sd(arr) Determines the standard deviation which shows how much variation there is from the average value of a set of numbers.
<static> | JXG.Math.Statistics.subtract(arr1, arr2) Subtracts two (sequences of) values.
<static> | JXG.Math.Statistics.sum(arr) Sums up all elements of the given array.
<static> | JXG.Math.Statistics.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 JXG.Math.Numerics.regressionPolynomial.
<static> | JXG.Math.Statistics.variance(arr) Bias-corrected sample variance.
<static> | JXG.Math.Statistics.weightedMean(arr, w) Weighted mean value is basically the same as JXG.Math.Statistics.mean but here the values are weighted, i.e.

Namespace Detail
JXG.Math.Statistics
Functions for mathematical statistics. Most functions are like in the statistics package R.
Method Detail
<static> {Array|Number} JXG.Math.Statistics.abs(arr)
Determines the absolute value of every given value.

Parameters:
{Array|Number} arr

Returns:
  {Array|Number}

<static> {Array|Number} JXG.Math.Statistics.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:
{Array|Number} arr1
{Array|Number} arr2

Returns:
  {Array|Number}

<static> {Array|Number} JXG.Math.Statistics.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:
{Array|Number} arr1
  Dividend
{Array|Number} arr2
  Divisor

Returns:
  {Array|Number}

<static> JXG.Math.Statistics.divide()

Deprecated:
Use JXG.Math.Statistics.div instead.

<static> {Number} JXG.Math.Statistics.generateGaussian(mean, stdDev)
Generate values of a standard normal random variable with the Marsaglia polar method, see https://en.wikipedia.org/wiki/Marsaglia_polar_method .

Parameters:
{Number} mean
  mean value of the normal distribution
{Number} stdDev
  standard deviation of the normal distribution

Returns:
  {Number} value of a standard normal random variable

<static> {Number} JXG.Math.Statistics.max(arr)
Extracts the maximum value from the array.

Parameters:
{Array} arr

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.

<static> {Number} JXG.Math.Statistics.mean(arr)
Determines the mean value of the values given in an array.

Parameters:
{Array} arr

Returns:
  {Number}

<static> {Number} JXG.Math.Statistics.median(arr)
The median of a finite set of values is the value that divides the set into two equal sized subsets.

Parameters:
{Array} arr
  The set of values.

Returns:
  {Number}

<static> {Number} JXG.Math.Statistics.min(arr)
Extracts the minimum value from the array.

Parameters:
{Array} arr

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.

<static> {Array|Number} JXG.Math.Statistics.mod(arr1, arr2, math)
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:
{Array|Number} arr1
  Dividend
{Array|Number} arr2
  Divisor
{Boolean} math Optional, Default: false
  Mathematical mod or symmetric mod? Default is symmetric, the JavaScript `%` operator.

Returns:
  {Array|Number}

<static> {Array|Number} JXG.Math.Statistics.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:
{Array|Number} arr1
{Array|Number} arr2

Returns:
  {Array|Number}

<static> {Number|Array} JXG.Math.Statistics.percentile(arr, percentile)
The P-th percentile ( 0 < P ≤ 100 ) of a list of N ordered values (sorted from least to greatest) is the smallest value in the list such that no more than P percent of the data is strictly less than the value and at least P percent of the data is less than or equal to that value. See https://en.wikipedia.org/wiki/Percentile. Here, the linear interpolation between closest ranks method is used.

Parameters:
{Array} arr
  The set of values, need not be ordered.
{Number|Array} percentile
  One or several percentiles

Returns:
  {Number|Array} Depending if a number or an array is the input for percentile, a number or an array containing the percentils is returned.

<static> {Number} JXG.Math.Statistics.prod(arr)
Multiplies all elements of the given array.

Parameters:
{Array} arr
  An array of numbers.

Returns:
  {Number}

<static> {Array} JXG.Math.Statistics.range(arr)
Determines the lowest and the highest value from the given array.

Parameters:
{Array} arr

Returns:
  {Array} The minimum value as the first and the maximum value as the second value.

<static> {Number} JXG.Math.Statistics.sd(arr)
Determines the standard deviation which shows how much variation there is from the average value of a set of numbers.

Parameters:
{Array} arr

Returns:
  {Number}

<static> {Array|Number} JXG.Math.Statistics.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:
{Array|Number} arr1
  Minuend
{Array|Number} arr2
  Subtrahend

Returns:
  {Array|Number}

<static> {Number} JXG.Math.Statistics.sum(arr)
Sums up all elements of the given array.

Parameters:
{Array} arr
  An array of numbers.

Returns:
  {Number}

<static> {Array} JXG.Math.Statistics.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 JXG.Math.Numerics.regressionPolynomial. If the function should be applied to an array a of points, a the coords array can be generated with JavaScript array.map:

    JXG.Math.Statistics.TheilSenRegression(a.map(el => el.coords));

Parameters:
{Array} coords
  Array of JXG.Coords.

Returns:
  {Array} A stdform array of the regression line.

Examples:

    var board = JXG.JSXGraph.initBoard('jxgbox', { boundingbox: [-6,6,6,-6], axis : true });
    var a=[];
    a[0]=board.create('point', [0,0]);
    a[1]=board.create('point', [3,0]);
    a[2]=board.create('point', [0,3]);

    board.create('line', [
        () => JXG.Math.Statistics.TheilSenRegression(a.map(el => el.coords))
      ],
      {strokeWidth:1, strokeColor:'black'});

<static> {Number} JXG.Math.Statistics.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:
{Array} arr

Returns:
  {Number}

<static> {Number} JXG.Math.Statistics.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:
{Array} arr
  Set of alues.
{Array} w
  Weight values.

Throws:
{Error}
  If the dimensions of the arrays don't match.

Returns:
  {Number}

Documentation generated by JsDoc Toolkit 2.4.0 on Wed Feb 14 2024 15:53:29 GMT+0100 (heure normale d’Europe centrale)