The Regression class is an abstract class for user defined classes
that can be used in the regression model. The class linear_regression
implemented in opus_core computes outcome
as a linear combination of given
data
and coefficients
:
. Here,
denotes the number of variables entering the
regression and
is an index for observations. The run() method takes
a 2-d array of data (of size number of observations
number of
variables) and a 1-d array of coefficients as arguments and returns a 1-d
array of outcome.
A child class of linear_regression, called linear_regression_with_normal_error,
adds normaly distributed random errors to the outcome:
where
.
and
, respectively, can be passed
to the run() method in its argument resources (dictionary) as entries
'linear_regression_error_mean' and 'linear_regression_error_variance', respectively. Both can be specified either as
a single value or as an array of size number of observations.
By default,
for all
.