When evaluating by obs, check the following code
Code: Select all
'create workfile
!T = 100
wfcreate(page=OLS) u 1 !T
'genr the data
rndseed(type=mt) 12357
genr x = rnd
genr y = 5 +3*x +nrnd
'Logl obj
logl L11
L11.append @logl L
'L11.append @byeqn
L11.append e = y -c(1) -c(2)*x
L11.append v = @sum(e^2)/!T
L11.append L = log(@dnorm(e/@sqrt(v))) - log(v)/2
'init the series
!init = 1
if !init then
genr e = 0
genr v = 1
endif
'estimate
L11.ml(showopts)
Questions
- There will be an error. However, check the series e and v, e(1)=@elem(y,@otod(1)), v(1)=0! why not v(1) = (@elem(y,@otod(1)))^2 /100 ?
- if !init = 1 change to !init = 0, then after the running error, the series e=y, and v=na, why e is evaluated for all obs?