inmoose.utils.lm_fit

class inmoose.utils.lm_fit(design, b)

Python equivalent to R lm.fit

This class is merely a wrapper around RegressionResults, the return type of OLS.fit() and WLS.fit().

It contains the solution to the equation \(A X = B\), where \(A\) is a known matrix, \(B\) a known vector and \(X\) the unknown to solve for. The solution is obtained by a least-square-error fit based on the QR-decomposition of \(A\).

Parameters:
  • design (array_like) – matrix \(A\) of the equation

  • b (array_like) – offset (vector \(B\) in the equation)

__init__(design, b)

Methods

__init__(design, b)

Attributes

coefficients

the value found for \(X\)

df_residuals

degrees of freedom of residuals

effects

vector of orthogonal single-df effects.

fitted_values

the value \(A X\)

qr

the QR decomposition of matrix \(A\)

rank

the column rank of matrix \(A\)

residuals

the residuals, i.e. the difference between \(A X\) and \(B\)

weights

the weights used in the least-square-error fit