Announcement

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

  • maximum likelihood estimation

    Hello community,

    I am trying to determine Maximum likelihood estimates with stata using the "program" command. Unfortunately I either receive a warning that it is not feasible to find values or that some regions are flat or discontinuous. However, I am following an approach from a paper and cannot see any reason why it shouldn't work. To provide you with some details, please find the exact Code below:

    program define bias
    args lnf b
    quietly replace `lnf' =(1-five*`b')/(1-0.05*`b')*(1/pvalue)
    end
    ml model lf bias (pvalue=) [aweight=1/numtest]
    ml max


    The variable "five" is an indicator which is 1 when a p-value is below or equal to 0.05 and 0 otherwise. I am trying to estimate "b" by maximizing the log likelihood function.
    I saw coding examples including the expression "$ML_y1"; but even if I replaced "pvalue" by this term I would still get an error message.

    I am extremly grateful for every hint and for every help with my Code from you!

    Kind regards

    Mascha

  • #2
    You'll increase your chances of a useful answer by following the FAQ on asking questions - provide Stata code in code delimiters, readable Stata output, and sample data using dataex.

    It is hard to tell you much about such errors if we cannot replicate them. I don't use ml sufficiently to diagnose your code. Is five or the p value generated within the model?

    The normal recommendation would be to (i) start with a very simple model using these variables and make sure it works (e.g., make everything linear and see if it still has problems) and (ii) work up to your full model (including weights etc.).

    Comment

    Working...
    X