I have a task to estimate the model to obtain b0 and b1 on the generated data (yt, zt and wt) using my created function and I'm not sure, how to do it. It's written that I should not use the existing functions such as lm(). Could someone explain and help me to understand that?
In my calculation b1=0.1646209 which is the same what lm() function shows:
lm(formula = y ~ z)
In that case b0 can be expressed like that
b0 = Yt - b1*zt - ut
But when I try to find b0 I get a lot of values instead of one, so probably this equation is not correct. Could you help me with finding b0 (intercept)?
Model: yt = b0 + b1*zt + ut
n <- 100
v <- rnorm(n ,mean=0, sd=0.27)
eps <- rnorm(n ,mean=0, sd=0.05)
u <- -0.5*v + eps
w <- rnorm(n ,mean=0, sd=1)
z <- 0.2*w + v
y <- 1 + 0.5*z + u