Global

Methods

(async) addCustomLegend(param0)

Adds a custom legend to the map based on the map type and position specified.

Parameters:
Name Type Description
param0 Object

Object containing the map type and position for the legend.

Properties
Name Type Description
position string

The position for the legend (top, top left, left, bottom left, bottom, bottom right, right, top right).

Source:

dotProduct(a, b) → {number}

Calculates the dot product of two vectors. Both vectors should be represented as 1D JS arrays with the same length

Parameters:
Name Type Description
a Array

The first vector

b Array

The second vector

Author:
  • riya-patil
Source:
Throws:

If the input vectors have different lengths

Type
Error
Returns:

The dot product

Type
number
Example
const a = [1, 2, 3, 4, 5]
const b = [10, 20, 30, 40, 50]
hydro.analyze.stats.dotProduct(a,b)

goldfeldQuandtTest(params) → {Object}

Performs Goldfeld-Quandt test for heteroscedasticity

Parameters:
Name Type Description
params Object

residuals (Array of residuals from a regression model), independentVar (Array of values of the independent variable)

Author:
  • riya-patil
Source:
Throws:

If the input arrays have different lengths

Type
Error
Returns:

Object containing test statistic and p-value

Type
Object
Example
const residuals = [1.2, 2.3, 0.8, 1.9, 1.5, 2.6];
const independentVar = [3, 4, 5, 6, 7, 8];
const result = stats.goldfeldQuandtTest({ params: { residuals, independentVar } });
console.log(result);

(async) recenter(param0)

Parameters:
Name Type Description
param0 *
Source:

whitesTest(params) → {Object}

Performs White's test for heteroscedasticity

Parameters:
Name Type Description
params Object

Parameters for the test, errors is array of residuals while regressors is array of regressor vars

Author:
  • riya-patil
Source:
Throws:

If the input arrays have different lengths

Type
Error
Returns:

Object containing test statistic and p-value

Type
Object
Example
const params = {
  errors: [1, 2, 3, 4, 5],
  regressors: [[1, 1], [2, 1], [3, 1], [4, 1], [5, 1]]
};
hydro.analyze.stats.whitesTest({ params });