class

DSP::Analysis::OLSMultipleLinearRegression

Inherits Reference < Object

Constructors

new(threshold : Float32)

Create an empty OLSMultipleLinearRegression instance, using the given singularity @threshold for the QR decomposition. Params: @threshold – the singularity @threshold

Source
new

Create an empty OLSMultipleLinearRegression instance.

Source

Instance methods

calculate_beta
Source
estimate_regression_params
Source
new_sample_data(y : Array(Float64), x : Array(Array(Float64)))

Loads model x and y sample data, overriding any previous sample. Computes and caches QR decomposition of the X matrix. Params: y – the [n,1] array representing the y sample x – the [n,k] array representing the x sample Throws: MathIllegalArgumentException – if the x and y array data are not compatible for the regression

Source
new_x_sample_data(x : Array(Array(Float64)))

Note that there is no need to add an initial unitary column (column of 1's) when specifying a model including an intercept term. This implementation computes and caches the QR decomposition of the X matrix once it is successfully loaded.

Source
new_y_sample_data(y : Array(Float64))

Loads new y sample data, overriding any previous data. Params: y – the array representing the y sample Throws: ArgumentError – if y is null ArgumentError – if y is empty

Source
no_intercept
Source
no_intercept=(no_intercept : Bool)
Source
validate_sample_data(x : Array(Array(Float64)), y : Array(Float64))

Validates sample data. Checks that Neither x nor y is null or empty; The size (i.e. number of rows) of x equals the size of y x has at least one more row than it has columns (i.e. there is sufficient data to estimate regression coefficients for each of the columns in x plus an intercept. Params: x – the [n,k] array representing the x data y – the [n,1] array representing the y data Throws: ArgumentError – if x or y is null DimensionMismatchException – if x and y do not have the same size ArgumentError – if x or y are zero-size MathIllegalArgumentException – if the number of rows of x is not larger than the number of columns + 1

Source