Announcement

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

  • ML Command: Help with programming a non-linear function

    Dear Stata Community,

    I am currently working on replicating the 2011 paper by Malmendier & Nagel. I have hit a roadblock in my analysis, and I am hoping for help/ a hint.

    I want to estimate a nonlinear regression to examine how past returns influence a household's investment decisions. The underlying assumption is that more recent returns have a stronger impact on decision-making than those further in the past (Malmendier & Nagel, 2011). This means that the weighting of a return depends on how many years ago it was realized. The sum of all weights always equals one, and the exact weight distribution is determined by the parameter λ. My goal is that the parameter λ (and its standard error) are estimated directly by the program.

    In other words, I want to estimate the following non-linear regression:



    Notably, yit is the fraction of liquid assets invested in stocks, k is the number of years since the return has been realized, and Rt-k is the respective return.

    In other words, my dataset includes:
    Variable Name Description
    age Age of the household head
    stk_exp_ret_1914
    (up to stk_exp_ret_2022)
    Experienced return in the year 1914
    • The dataset lists all returns from 1914 to 2022
    • Stk_exp_ret_* = 0 if the return was not experienced (either not born yet or the return occurred after the survey date)
    k_1914
    (up to k_2022)
    Number of years since the return in the respective year was experienced
    • 0 if the return was not experienced
    • k takes a maximum value of age-1
    fraction_liq_stock The proportion of liquid assets that the household invests in stocks
    normalized_weight Weighting of the respective household

    So far, I have tried writing an ml command, but unfortunately, it does not work. I would be extremely grateful for help. Thanks a lot in advance.
    Click image for larger version

Name:	Bildschirmfoto 2025-02-10 um 16.18.36.png
Views:	1
Size:	511.6 KB
ID:	1772447
Working...
X