Link Search Menu Expand Document

Regression

regression.ts#L160

bestPolynomial (data: Array<Coordinate>, threshold: number, maxOrder: number): undefined|{coefficients: Array<number>, fn: (x: number): number, order: number}

Finds the most suitable polynomial regression for a given dataset.

Name Type Default Description
data Array<Coordinate>    
threshold number 0.85  
maxOrder number 8  
regression.ts#L142

coefficient (data: Array<Coordinate>, fn: (x: number): number): number

Finds the regression coefficient of a given data set and regression function.

Name Type Default Description
data Array<Coordinate>    
fn (x: number): number    
regression.ts#L53

exponential (data: Array<Coordinate>): Array<number>

Finds an exponential regression that best approximates a set of data. The result will be an array [a, b], where y = a * e^(bx).

Name Type Default Description
data Array<Coordinate>    
regression.ts#L27

linear (data: Array<Coordinate>, throughOrigin: boolean): Array<number>

Finds a linear regression that best approximates a set of data. The result will be an array [c, m], where y = m * x + c.

Name Type Default Description
data Array<Coordinate>    
throughOrigin boolean false  
regression.ts#L76

logarithmic (data: Array<Coordinate>): Array<number>

Finds a logarithmic regression that best approximates a set of data. The result will be an array [a, b], where y = a + b * log(x).

Name Type Default Description
data Array<Coordinate>    
regression.ts#L119

polynomial (data: Array<Coordinate>, order: number): Array<number>

Finds a polynomial regression of given order that best approximates a set of data. The result will be an array giving the coefficients of the resulting polynomial.

Name Type Default Description
data Array<Coordinate>    
order number 2  
regression.ts#L97

power (data: Array<Coordinate>): Array<number>

Finds a power regression that best approximates a set of data. The result will be an array [a, b], where y = a * x^b.

Name Type Default Description
data Array<Coordinate>    

Copyright © 2021 Mathigon.org