r=f(X)+ϵ;ϵ∼N(μ,σ2)
is a line that minimizes squared error.
g(xt∣w0,w1)=w1xt+w0
is the line defined by parameters w0,w1. We need to find the line that minimizes squared error, and to do so, we need to compute the values for w0,w1 that minimize the squared error.
We have X={xt,rt}t=1N
We need to compute argminw0,w1∑t(rt−(w1xt+w0))2
To solve for w0,w1, take partial derivatives w.r.t w0 and w1 and equate them to 0. We will get 2 equations:
∑trt=Nw0+w1∑txt
∑trtxt=w0∑txt+w1∑t(xt)2
To solve for w0,w1, we use the closed form solution:
W=A−1y
where W=[w0w1],A=[N∑txt∑txt∑t(xt)2],Y=[∑trt∑trtxt]