Given a set of data vectors in the following format:
y = { y 1 , y 2 , . . . , y n } {\displaystyle y=\{y_{1},y_{2},...,y_{n}\}}
x i = { x i 1 , x i 2 , . . . , x i n } , i ∈ 1.. k {\displaystyle x_{i}=\{x_{i1},x_{i2},...,x_{in}\},i\in 1..k}
Compute the vector β = { β 1 , β 2 , . . . , β n } {\displaystyle \beta =\{\beta _{1},\beta _{2},...,\beta _{n}\}} using ordinary least squares regression using the following equation:
y i = β ⋅ x i {\displaystyle y_{i}=\beta \cdot x_{i}}
You can assume y is given to you as an array, and x is given to you as a two-dimensional array.