RosettaCodeData/Task/Multiple-regression/00DESCRIPTION

14 lines
593 B
Text
Raw Permalink Normal View History

2016-12-05 22:15:40 +01:00
;Task:
2013-04-10 21:29:02 -07:00
Given a set of data vectors in the following format:
2016-12-05 22:15:40 +01:00
<math>y = \{ y_1, y_2, ..., y_n \}\,</math>
2013-04-10 21:29:02 -07:00
2016-12-05 22:15:40 +01:00
<math>X_i = \{ x_{i1}, x_{i2}, ..., x_{in} \}, i \in 1..k\,</math>
2013-04-10 21:29:02 -07:00
2016-12-05 22:15:40 +01:00
Compute the vector <math>\beta = \{ \beta_1, \beta_2, ..., \beta_k \}</math> using [[wp:Ordinary least squares|ordinary least squares]] regression using the following equation:
2013-04-10 21:29:02 -07:00
2016-12-05 22:15:40 +01:00
<math>y_j = \Sigma_i \beta_i \cdot x_{ij} , j \in 1..n</math>
2013-04-10 21:29:02 -07:00
2016-12-05 22:15:40 +01:00
You can assume <i> y </i> is given to you as a vector (a one-dimensional array), and <i> X </i> is given to you as a two-dimensional array (i.e. matrix).
<br><br>