Table of Contents

Struct LinearRegression

Namespace
ScottPlot.Statistics
Assembly
ScottPlot.dll
public readonly struct LinearRegression
Inherited Members
Extension Methods

Constructors

LinearRegression(Coordinates[])

Calculate the linear regression from a collection of X/Y coordinates

public LinearRegression(Coordinates[] coordinates)

Parameters

coordinates Coordinates[]

LinearRegression(IEnumerable<Coordinates>)

Calculate the linear regression from a collection of X/Y coordinates

public LinearRegression(IEnumerable<Coordinates> coordinates)

Parameters

coordinates IEnumerable<Coordinates>

LinearRegression(double[], double, double)

Calculate the linear regression from a collection of evenly-spaced Y values

public LinearRegression(double[] ys, double firstX = 0, double xSpacing = 1)

Parameters

ys double[]
firstX double
xSpacing double

LinearRegression(double[], double[])

Calculate the linear regression a paired collection of X and Y points

public LinearRegression(double[] xs, double[] ys)

Parameters

xs double[]
ys double[]

Fields

Offset

public readonly double Offset

Field Value

double

Rsquared

public readonly double Rsquared

Field Value

double

Slope

public readonly double Slope

Field Value

double

Properties

Formula

public string Formula { get; }

Property Value

string

FormulaWithRSquared

public string FormulaWithRSquared { get; }

Property Value

string

Methods

GetValue(double)

Return the Y point of the regression line for the given X position

public double GetValue(double x)

Parameters

x double

Returns

double

GetValues(double[])

Return the Y points of the regression line for the given X positions

public double[] GetValues(double[] xs)

Parameters

xs double[]

Returns

double[]