Announcement

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

  • MLE Code

    Hi everyone,
    I am replicating this code as follows:

    clear all
    webuse set "https://rlhick.people.wm.edu/econ407/data"
    webuse tobias_koop
    keep if time==4
    su ln_wage educ pexp pexp2 broken_home

    regress ln_wage educ pexp pexp2 broken_home

    program define ols_mle

    args lnf xb log_sigma2

    qui replace `lnf' =ln(1/sqrt(2*_pi*exp(`log_sigma2'))) - (($ML_y1 - `xb')^2)/(2*exp(`log_sigma2'))

    end

    ml clear

    ml model lf ols_mle (ln_wage=educ pexp pexp2 broken_home) (log_sigma2


    Could someone help me understand what the program define component is doing?
    I am trying to tie this back to the likelihood function and log likelihood equations but having a hard time trying to reconcile the code and theory. I have attached the likelihood function and log likelihood function for the two variable case.

    Thank you for your help with this.

    Click image for larger version

Name:	LF.png
Views:	1
Size:	8.6 KB
ID:	1746964

    Click image for larger version

Name:	LogLF.png
Views:	1
Size:	9.1 KB
ID:	1746965





  • #2
    Bumping this up in case someone has an idea how this works.

    Comment


    • #3
      Program define and args are simply part of the syntax of how Stata needs for you to define the objective function to be maximized, the parameters that will be estimated
      the only part that connects directly with male is the line that starts with quietly replace

      Comment

      Working...
      X