Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • A problem with Log Likelihood estimation with artificial data. I need help with this, thank you

    Hello everybody,

    I'm trying to estimate An, As, Bn and Bs, where An and As are constants, while Bn and Bs are coefficients.
    I'm using an artificial dataset and I have thinked to use a Log Likehood 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.

    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 normal
    version 16
    args todo b lnf
    tempvar mu_Fn sigma_Fn mu_Fs sigma_Fs
    mleval `mu_Fn' = `b'
    mleval `sigma_Fn' = `b'
    mleval `mu_Fs' = `b'
    mleval `sigma_Fs' = `b'

    // ML Function
    quietly replace `lnf' = ln(normalden(($ML_y1 - `mu_Fn')/`sigma_Fn')) - ln(`sigma_Fn') + (ln(normalden(($ML_y2 - `mu_Fs')/`sigma_Fs')) - ln(`sigma_Fs'))

    end

    ml model lf0 normal (F = Dn) (sigma_Fn (F = Ds) (sigma_Fs
    ml max
Working...
X