Announcement

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

  • Optimizing Coefficients to Satisfy Equation Restriction

    Hi everyone,

    Code:
    clear
    input str20 id double y str20 owner str2 country float(x lz ly lw)
    "2"  115635 "1" "S" -.012190863 14.197766 11.658194 9.714953
    "3"  889660 "1" "A"   .03102498 13.579182 13.698595 10.72123
    "4"   57904 "1" "P"  -.05192963 11.621798  10.96654 9.423738
    "5"  282576 "1" "R"  -.08859473 14.767591 12.551702 9.148927
    "1" 8175613 "1" "A"   .03102498 18.930506 15.916666 10.72123
    "6"   16931 "1" "R"  -.03904345  11.63438  9.736901 9.071641
    end
    This is a dataset with firms. id is the id of each firm. owner is the owner of each firm and you can see that it is the same for all 6 firms and in row five the firm=owner("1"). country is the country in which each firm resides and ly is the logarithm of variable y, which is the dependent variable. Now the main regression is

    reg ly x lz lw

    or if I use country fixed effects

    reghdfe ly x lz lw, a(country)

    Of course here country fixed effects do not give anything, but my dataset has a lot of firms in different countries and with a lot of owners (this is just an example with 1 owner). My main independent variable is x. When I run the main regression without fixed effects I get a coefficient b for x, which is the same for all 6 observations. For theoretical reasons in my analysis I want to have a different b for each observation. So I rely on npregress kernel and after some modifications I run the following:

    npregress kernel ly c , predict(mean deriv)

    where c is something like an adjusted x. Now this prints a deriv for each observation, essentially a different b for each observation(each firm). Now what I want is to create for each firm the following:

    gen var=y - (y / (1 - b *x))

    using each observation's b, which I can, but i want the sum of all the 6 different values (observations created) of var to be 0, which is doable because as you can see the variable x takes positive and negative values. To do that, i think that either one has to estimate the different b for each firm from npregress kernel in a way that it satisfies this restriction or after getting these different b apply a rule to transform them to satisfy the restriction but without loosing the information that they provided for each firm after npregress kernel. If what i am asking for is doable i would like to solve it with non-parametrics but if that is not the case and you can propose another solution to get the different b for each firm and apply the above restriction it would be great to compare. Many thanks to all for this great forum.
    Last edited by Fotis Delis; 29 Jun 2023, 10:13.

  • #2
    Any suggestions for this post?

    Comment

    Working...
    X