Announcement

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

  • Help on Threshold regressio

    Good afternoon to you all
    My name is David and am new to Stata. My problem is that i want to use Stata to estimate threshold level but i don't how
    go about it. I try also to generate new variable from my data but it seems am not doing it right.
    Please if could permit me i would like to add my data and model for you to advice me on what to do.
    id year Volume Value Market Cap Inflation
    1 2013 531.81 45,739,551 35408010 11.7
    1 2014 553.74 79,472,245 71,419,962.81 15.5
    1 2015 548.26 23,129,454 21,257,815.37 17.1
    1 2016 411.2 11,835,752 10,946,399.90 17.5
    1 2017 592.12 190,667,899 254,723,222.30 12.4
    2 2013 1645.01 14658999 65129460 11.7
    2 2014 2,228.54 6,776,134 46,640,857.62 15.5
    2 2015 2,055.53 2 ,186,876 16,734,981.26 17.1
    2 2016 1876.66 1,308,656 8,924,413.42 17.5
    2 2017 2,228.54 3,396,754 24,642,645.00 12.4
    3 2013 3032.97 20780811 3701180 11.7
    3 2014 5,967.91 22,842,475 6,054,169.85 15.5
    3 2015 6498.29 13,623,044 4,123,181.46 17.1
    3 2016 2406.78 13,206,588 2,622,574.05 17.5
    3 2017 3,850.84 15,227,384 2,055,929.71 12.4
    4 2013 1285.25 11946366 56389940 11.7
    4 2014 1,404.50 12,009,864 58,515,182.40 15.5
    4 2015 1004.35 9 ,634,831 41,723,786.82 17.1
    4 2016 943.4 8097974 28,571,555.65 17.5
    4 2017 1,338.25 8,634,777 41,338,960.34 12.4


    Yit =µi +β1×it h (qit < γ1) +𝛽2×it h (γ1<qitγ2) +𝛽3×it h (qitγ2) + 𝜀it

  • #2
    If the values of γ1 and γ2 are known, then you can do this by creating new variables from h using the -mkspline- command with knots at γ1 and γ2, and then using those new variables in your regression instead of h.

    If the values of γ1 and γ2 are not known, and you want Stata to calculate them for you, there is a Stata command, -threshold- that will estimate this kind of model for you. I believe it is new in Stata 16, however, so if you are using an older version, there is no official Stata command for this, and I am not aware of any user-written ones either.

    I try also to generate new variable from my data but it seems am not doing it right.
    Without showing the code you tried, and an explanation of in what sense it did not work, it isn't really possible to help you with this. Please post back with more information.
    Last edited by Clyde Schechter; 18 Sep 2019, 11:52.

    Comment


    • #3
      Clyde thank you very much. The thing is that i try to follow Hansen example to generate a new variable from my data but i don't know if i should do something to the data before i can go ahead and generate the variables. Please take the second look at my date again and advice me on what to do.
      Thanks

      Comment


      • #4
        What does "Hansen example" mean?

        In any case, it is impossible to troubleshoot code that you don't show. If you want help fixing some code you need to show:

        1. The exact code you ran.
        2. The output that Stata gave you, including any error messages.
        3. And, unless it is obvious, an explanation of why what Stata gave you isn't what you want, and, again, unless it is obvious, a clear description of what you do want.

        Comment


        • #5
          Thanks Prof.
          This the command i used, gen inf1=L.inflation
          error message: nothing fund where name expected

          Comment


          • #6
            I have never seen that error message in association with that kind of command. I can think of a few things that would cause this command to fail, but with different error messages than the one you show:

            1. If you do not have a variable named inflation in your data set. Check that you have spelled the variable name correctly, and keep in mind that variable names in Stata are case-sensitive.

            2. You did not -tsset- your data (or -xtset- with a time variable). Without that the lag operator L is not available.

            Comment


            • #7
              I don't know what to do now, i try the tsset command it giving me time variable not set. Prof. in actual fact am new to stata and sorry for disturbing you. I am highly appreciate for your time.

              Comment

              Working...
              X