Dear all,
I have a variable F that is osservable. And F = Fn + Fs, but I don't know Fn and Fs.
But I know that Fn = An + Bn*(Sn-l.Sn) + en, and Fs = As + Bs*(Ss-l.Ss) + es,
where Sn and Ss are two variables, l.Sn and l.Sn are Ss and Sn lagged,
An and As are the intercepts, Bn and Bs are the coefficients, and en and es are the error terms.
Now, I want to estimate An, As, Bs and Bn, I thought to use a Log Likelihood estimation, but the function doesn't converg.
The error is:
initial: log likelihood = -<inf> (could not be evaluated)
could not find feasible values
Below I report the do file with artificial data.
Thank you.
GD
clear
set obs 1000
gen t = _n
tsset t
gen Sn = runiform(10000,30000)
gen Ss = runiform(50000,100000)
scalar An = 5000
scalar As = 10000
scalar Bn = 200
scalar Bs = 30
gen Fn = An + Bn*(Sn-l.Sn) + rnormal(0,600)
gen Fs = As + Bs*(Ss-l.Ss) + rnormal(0,200)
gen F = Fn + Fs
// Fn and Fs are not osservable, and I don't know An, As, Bn, Bs. I osserve only F, Sn ed Ss.
gen Dn = Sn-l.Sn
gen Ds = Ss-l.Ss
prog drop _all
program mlef
version 16
args todo b lnf
tempvar mu_Fn sigma_Fn mu_Fs sigma_Fs
mleval `mu_Fn' = `b', eq(1)
mleval `sigma_Fn' = `b', eq(2) scalar
mleval `mu_Fs' = `b', ep(3)
mleval `sigma_Fs' = `b', eq(4) scalar
// ML Function
quietly replace `lnf' = ln(normalden($ML_y1 , `mu_Fn' , `sigma_Fn')) + ln(normalden($ML_y2 , `mu_Fs' , `sigma_Fs'))
end
ml model lf0 mlef (F = Dn) (sigma_F: ) (F = Ds) (sigma_Fs: )
ml max
I have a variable F that is osservable. And F = Fn + Fs, but I don't know Fn and Fs.
But I know that Fn = An + Bn*(Sn-l.Sn) + en, and Fs = As + Bs*(Ss-l.Ss) + es,
where Sn and Ss are two variables, l.Sn and l.Sn are Ss and Sn lagged,
An and As are the intercepts, Bn and Bs are the coefficients, and en and es are the error terms.
Now, I want to estimate An, As, Bs and Bn, I thought to use a Log Likelihood estimation, but the function doesn't converg.
The error is:
initial: log likelihood = -<inf> (could not be evaluated)
could not find feasible values
Below I report the do file with artificial data.
Thank you.
GD
clear
set obs 1000
gen t = _n
tsset t
gen Sn = runiform(10000,30000)
gen Ss = runiform(50000,100000)
scalar An = 5000
scalar As = 10000
scalar Bn = 200
scalar Bs = 30
gen Fn = An + Bn*(Sn-l.Sn) + rnormal(0,600)
gen Fs = As + Bs*(Ss-l.Ss) + rnormal(0,200)
gen F = Fn + Fs
// Fn and Fs are not osservable, and I don't know An, As, Bn, Bs. I osserve only F, Sn ed Ss.
gen Dn = Sn-l.Sn
gen Ds = Ss-l.Ss
prog drop _all
program mlef
version 16
args todo b lnf
tempvar mu_Fn sigma_Fn mu_Fs sigma_Fs
mleval `mu_Fn' = `b', eq(1)
mleval `sigma_Fn' = `b', eq(2) scalar
mleval `mu_Fs' = `b', ep(3)
mleval `sigma_Fs' = `b', eq(4) scalar
// ML Function
quietly replace `lnf' = ln(normalden($ML_y1 , `mu_Fn' , `sigma_Fn')) + ln(normalden($ML_y2 , `mu_Fs' , `sigma_Fs'))
end
ml model lf0 mlef (F = Dn) (sigma_F: ) (F = Ds) (sigma_Fs: )
ml max