Announcement

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

  • Regression by year and companyID to save coefficients


    Hello, I am trying to run regressions by companyID and year, and save the coefficients for each firm-year model as new variables in a new column right besides the other columns. There is an additional wrinkle‹ I have panel data for 1990-2010 and want to run each regression using t to t-4 only (I.e., for 2001, use only 1998-2001 years of data and i.e. for 1990 then only the data of 1990 and so on). I am new to using foreach loops and I found some prior coding on the web. I have tried to adapt it to my situation but two issues: anything.....

    1. the output is staying blank

    2. I have not figured out how to use the rolling four year data periods.

    Here is the code I tried. Any suggestions would be much appreciated.

    Code:
    use paneldata.dta // the dataset I am working in
    generate coeff . //empty variable for coefficient
    foreach x of local levels {
    forval z = 1990/2010
    {
    capture reg excess_returns excess_market
    replace coeff = _b[fyear] & _b[CompanyID] if e(sample) }
    }
    Last edited by Jan Filips; 29 Apr 2017, 04:16.

  • #2
    Cross-posted to Stack Overflow at http://stackoverflow.com/questions/4...e-coefficients.

    Comment


    • #3
      Originally posted by William Lisowski View Post
      Hi William,

      You're right, that is indeed my crosspost on Stackoverflow ! I forgot to mention it in the first post. Thanks for mentioning. I crossposted because I am heavily stuck with this.. . Hence, thanks in advance.
      Last edited by Jan Filips; 29 Apr 2017, 06:21.

      Comment


      • #4
        -

        Comment


        • #5
          Originally posted by William Lisowski View Post


          So below is a short snapshot of what the data looks like;

          Code:
          CompanyID Re_Rf Rm-Rf Year
          10 2 2 1990
          10 3 2 1991
          15 3 2 1991
          15 4 2 1992
          15 5 2 1993
          21 4 2 1990
          21 4 2 1991
          34 3 1 1990
          34 3 1 1991
          34 4 1 1992
          34 2 1 1993  
          34 3 1 1994
          34 4 1 1995
          34 2 1 1996


          Re_Rf = excess_returns

          Rm_Rf = excess_market

          I want to run the following regression:
          Code:
           reg excess_returns excess_market
          As stated earlier;

          I am trying to run regressions by companyID and year, and save the coefficients for each firm-year model as new variables in a new column right besides the other columns. There is an additional wrinkle‹ I have panel data for 1990-2010 and want to run each regression using t to t-4 only (I.e., for 2001, use only 1998-2001 years of data and i.e. for 1990 then only the data of 1990 and so on).

          Comment


          • #6
            what you want is still not completely clear to me, but you should have a look at the help (and/or manual entry) for -statsby-; if you really want to merge the saved data from -statsby- with your original data just use -merge- at the end (be sure to use the "saving" option to -statsby-)

            Comment


            • #7
              Originally posted by Rich Goldstein View Post
              what you want is still not completely clear to me, but you should have a look at the help (and/or manual entry) for -statsby-; if you really want to merge the saved data from -statsby- with your original data just use -merge- at the end (be sure to use the "saving" option to -statsby-)
              The regression I want to perform is the following
              Code:
              (Re - Rf) = a + B (Rm - Rf)
              Or better:
              Code:
              Excess_return = a + B (excess_market)
              This regression must therefore be carried out for each year of each CompanyID based on available information from the previous years.

              The first year of each CompanyID has an empty cell because that is the base year, the second year (row) of each CompanyID can also not be used because there is no data from the past. So it's best to look at every third year of each CompanyID and thus to execute the regression.



              Thus, from CompanyID 1045 (American Airlines) there is no data available on these variables in the first year (1964). The best thing is to do the regression from the third year (1966). The regression of the third year must therefore look at the (Re-Rf) and (Rm-Rf) of 1965 and 1966. For the regression of 1970, look at the 1965-1970 etc .. This for every year and Any CompanyID.

              The intention is, therefore, to eventually collect all beta coefficients of each regression and sort it as column next to each CompanyID

              Comment


              • #8
                It would be useful would be for you to install and use the dataex command, as described in section 12.2 of the Statalist FAQ, to provide 21 years of sample data for, say, three of your companies. Something like this:
                Code:
                dataex CompanyID Year excess_returns excess_market if inlist(CompanyID,10,21,34)
                assuming I have used the correct variable names and assuming each of the three CompanyIDs given have 21 years of sample data.

                Your code as posted in #1 above has a number of problems, not the least of which is the incorrect placement of the open and close braces on your forvalues loop. Rather than comment on it, it will be easier to create correct code using a sample of your data to reduce the possibility of misunderstanding of your data (on our part) and mistranslation of our code to your actual circumstances (on your part).

                Added in edit: This crossed in cyberspace with post #7. Please do read and act on the Statalist FAQ. A picture of your data is of no use, as the FAQ explains.
                Last edited by William Lisowski; 29 Apr 2017, 10:41.

                Comment


                • #9
                  Originally posted by William Lisowski View Post
                  It would be useful would be for you to install and use the dataex command, as described in section 12.2 of the Statalist FAQ, to provide 21 years of sample data for, say, three of your companies. Something like this:
                  Code:
                  dataex CompanyID Year excess_returns excess_market if inlist(CompanyID,10,21,34)
                  assuming I have used the correct variable names and assuming each of the three CompanyIDs given have 21 years of sample data.

                  Your code as posted in #1 above has a number of problems, not the least of which is the incorrect placement of the open and close braces on your forvalues loop. Rather than comment on it, it will be easier to create correct code using a sample of your data to reduce the possibility of misunderstanding of your data (on our part) and mistranslation of our code to your actual circumstances (on your part).

                  Added in edit: This crossed in cyberspace with post #7. Please do read and act on the Statalist FAQ. A picture of your data is of no use, as the FAQ explains.
                  I found a similar question from somebody that dates from exactly one year ago, but I did not come any further. I am really new to STATA, which is a big disadvantage for me at the moment:

                  The guy in this topic just wanted approx. exactly what I want right now...

                  http://www.statalist.org/forums/foru...tas-for-stocks



                  I will install dataex right now.

                  Comment


                  • #10
                    Originally posted by William Lisowski View Post
                    It would be useful would be for you to install and use the dataex command, as described in section 12.2 of the Statalist FAQ, to provide 21 years of sample data for, say, three of your companies. Something like this:
                    Code:
                    dataex CompanyID Year excess_returns excess_market if inlist(CompanyID,10,21,34)
                    assuming I have used the correct variable names and assuming each of the three CompanyIDs given have 21 years of sample data.

                    Your code as posted in #1 above has a number of problems, not the least of which is the incorrect placement of the open and close braces on your forvalues loop. Rather than comment on it, it will be easier to create correct code using a sample of your data to reduce the possibility of misunderstanding of your data (on our part) and mistranslation of our code to your actual circumstances (on your part).

                    Added in edit: This crossed in cyberspace with post #7. Please do read and act on the Statalist FAQ. A picture of your data is of no use, as the FAQ explains.
                    I used:
                    Code:
                     dataex gvkey fyear Re_Rf Rm_Rf


                    Code:
                    * Example generated by -dataex-. To install: ssc install dataex
                    clear
                    gvkey fyear (Re_Rf) (Rm_Rf)
                    1004 1967           .   .18042967
                    1004 1968    .4997567   .04354862
                    1004 1969  -.51990896   -.1656137
                    1004 1970    .3101502  -.01378855
                    1004 1971   1.1372168    .0976115
                    1004 1972   -.6249813   .13075364
                    1004 1973   -.3449303  -.21608047
                    1004 1974  -.37470475   -.3325179
                    1004 1975   .24874464    .3083514
                    1004 1976   .09613729      .18971
                    1004 1977  -.09278844  -.13959704
                    1004 1978   -.1292292  -.04060716
                    1004 1979  -.12904808    .0681949
                    1004 1980   -.0776246   .17875245
                    1004 1981   -.4898219   -.1805239
                    1004 1982    1.020343   .11739055
                    1004 1983   .22123416   .12257156
                    1004 1984  -.13066158  -.03073858
                    1004 1985   .18400025    .2363515
                    1004 1986   .22621344   .12544578
                    1004 1987  -.24383955 -.012872783
                    1004 1988    .1535819   .07517193
                    1004 1989   -.3975999   .23715183
                    1004 1990   -.4034941  -.09884451
                    1004 1991  -.12969565   .26114842
                    1004 1992  .012443732   .03883728
                    1004 1993  .028514784   .06337052
                    1004 1994 -.011130358   -.0587408
                    1004 1995    .3990197     .320152
                    1004 1996    .3460293   .17170966
                    1004 1997    -.202277   .27593654
                    1004 1998   -.2982551   .23807953
                    1004 1999   -.3572684    .1490535
                    1004 2000  -.05189099   -.1512182
                    1004 2001  -.20455714  -.14019759
                    1004 2002   -.6198434  -.23286048
                    1004 2003   1.1162889     .270958
                    1004 2004    .6468216   .07992776
                    1004 2005    .4733469  .020444775
                    1004 2006    .3058678   .11232558
                    1004 2007   -.4401692  .021447353
                    1004 2008  -.24125187  -.36922345
                    1004 2009   .33543605   .25465235
                    1004 2010    .3366939   .14531092
                    1004 2011  -.54628766  .018083747
                    1004 2012    .6631303   .15730585
                    1004 2013    .2100659   .32015085
                    1004 2014   .21313787   .13274422
                    1045 1964           .   .12425456
                    1045 1965   .31643295   .07439242
                    1045 1966    .0787425  -.14970954
                    1045 1967   -.5684696   .18042967
                    1045 1968 -.027562963   .04354862
                    1045 1969  -.20462857   -.1656137
                    1045 1970   -.3176927  -.01378855
                    1045 1971    .7665111    .0976115
                    1045 1972   -.4402356   .13075364
                    1045 1973   -.7297164  -.21608047
                    1045 1974   -.4792971   -.3325179
                    1045 1975    .6701073    .3083514
                    1045 1976    .4725268      .18971
                    1045 1977  -.28276297  -.13959704
                    1045 1978   .14135882  -.04060716
                    1045 1979   -.3528491    .0681949
                    1045 2003   .26641235     .270958
                    1045 2007   .04999769  .021447353
                    1045 2014    2.820023   .13274422
                    1045 2015  -.21683004  .007099495
                    1050 1982           .   .11739055
                    1050 1983  -.25464615   .12257156
                    1050 1993   .12260923   .06337052
                    1050 1994   -.4836723   -.0587408
                    1050 1995    .5812663     .320152
                    1050 1996    -.401932   .17170966
                    1050 1997    .4758997   .27593654
                    1050 1998  -.06554799   .23807953
                    1050 1999  -.22646667    .1490535
                    1050 2000  -.51089996   -.1512182
                    1050 2001      1.3783  -.14019759
                    1050 2002  -.45259395  -.23286048
                    1050 2003   -.1207081     .270958
                    1050 2004   1.0573485   .07992776
                    1050 2005    .6406756  .020444775
                    1050 2006     .518945   .11232558
                    1050 2007   .19068027  .021447353
                    1050 2008   -.7832993  -.36922345
                    1050 2009    .6275314   .25465235
                    1050 2010   .50596076   .14531092
                    1050 2011 -.071691945  .018083747
                    1050 2012    .7911928   .15730585
                    1050 2013    .6220166   .32015085
                    1050 2014  -.04039004   .13274422
                    1050 2015   -.5122915  .007099495
                    1072 1973           .  -.21608047
                    1072 1974   -.8257936   -.3325179
                    1072 1975   .27173272    .3083514
                    1072 1976     1.59029      .18971
                    1072 1977    .4249374  -.13959704
                    1072 1978    .1759901  -.04060716
                    1072 1979   .09179108    .0681949
                    end

                    Comment


                    • #11
                      You did not copy the data example generated by dataex as is because there's no input command.

                      From previous posts, it appears that you want to perform the following regression:
                      Code:
                      regress Re_Rf Rm_Rf
                      and you want to perform this regression on data from the same company within a retrospective window of 5 years that includes the current observation.

                      At a minimum, you should be able to get the results you want for any observation by simply specifying the regression with a condition that selects the correct set of observations to use. See help subscripting, help _variables, and help inrange(). For example, gvkey[10] refers to the value of gvkey for observation 10. Similarly, fyear[10] refers to the value of fyear for observation 10. In the data you posted, observation 10 has a value for gvkey of 1004 and 1976 for fyear. So to generate the results you want for observation 10, you would type:
                      Code:
                      regress Re_Rf Rm_Rf if gvkey == gvkey[10] & inrange(fyear, fyear[10]-4, fyear[10])
                      This type of regression over a rolling window of time is easy to do with rangestat, especially with the recent update that includes a built-in regression function. To install rangestat, type in Stata's Command window:
                      Code:
                      ssc install rangestat
                      Before you try anything, read the help file, it has numerous examples, including one that explains in detail the code below:

                      Code:
                      * Example generated by -dataex-. To install: ssc install dataex
                      clear
                      input float(gvkey fyear Re_Rf Rm_Rf)
                      1004 1967           .   .18042967
                      1004 1968    .4997567   .04354862
                      1004 1969  -.51990896   -.1656137
                      1004 1970    .3101502  -.01378855
                      1004 1971   1.1372168    .0976115
                      1004 1972   -.6249813   .13075364
                      1004 1973   -.3449303  -.21608047
                      1004 1974  -.37470475   -.3325179
                      1004 1975   .24874464    .3083514
                      1004 1976   .09613729      .18971
                      1004 1977  -.09278844  -.13959704
                      1004 1978   -.1292292  -.04060716
                      1004 1979  -.12904808    .0681949
                      1004 1980   -.0776246   .17875245
                      1004 1981   -.4898219   -.1805239
                      1004 1982    1.020343   .11739055
                      1004 1983   .22123416   .12257156
                      1004 1984  -.13066158  -.03073858
                      1004 1985   .18400025    .2363515
                      1004 1986   .22621344   .12544578
                      1004 1987  -.24383955 -.012872783
                      1004 1988    .1535819   .07517193
                      1004 1989   -.3975999   .23715183
                      1004 1990   -.4034941  -.09884451
                      1004 1991  -.12969565   .26114842
                      1004 1992  .012443732   .03883728
                      1004 1993  .028514784   .06337052
                      1004 1994 -.011130358   -.0587408
                      1004 1995    .3990197     .320152
                      1004 1996    .3460293   .17170966
                      1004 1997    -.202277   .27593654
                      1004 1998   -.2982551   .23807953
                      1004 1999   -.3572684    .1490535
                      1004 2000  -.05189099   -.1512182
                      1004 2001  -.20455714  -.14019759
                      1004 2002   -.6198434  -.23286048
                      1004 2003   1.1162889     .270958
                      1004 2004    .6468216   .07992776
                      1004 2005    .4733469  .020444775
                      1004 2006    .3058678   .11232558
                      1004 2007   -.4401692  .021447353
                      1004 2008  -.24125187  -.36922345
                      1004 2009   .33543605   .25465235
                      1004 2010    .3366939   .14531092
                      1004 2011  -.54628766  .018083747
                      1004 2012    .6631303   .15730585
                      1004 2013    .2100659   .32015085
                      1004 2014   .21313787   .13274422
                      1045 1964           .   .12425456
                      1045 1965   .31643295   .07439242
                      1045 1966    .0787425  -.14970954
                      1045 1967   -.5684696   .18042967
                      1045 1968 -.027562963   .04354862
                      1045 1969  -.20462857   -.1656137
                      1045 1970   -.3176927  -.01378855
                      1045 1971    .7665111    .0976115
                      1045 1972   -.4402356   .13075364
                      1045 1973   -.7297164  -.21608047
                      1045 1974   -.4792971   -.3325179
                      1045 1975    .6701073    .3083514
                      1045 1976    .4725268      .18971
                      1045 1977  -.28276297  -.13959704
                      1045 1978   .14135882  -.04060716
                      1045 1979   -.3528491    .0681949
                      1045 2003   .26641235     .270958
                      1045 2007   .04999769  .021447353
                      1045 2014    2.820023   .13274422
                      1045 2015  -.21683004  .007099495
                      1050 1982           .   .11739055
                      1050 1983  -.25464615   .12257156
                      1050 1993   .12260923   .06337052
                      1050 1994   -.4836723   -.0587408
                      1050 1995    .5812663     .320152
                      1050 1996    -.401932   .17170966
                      1050 1997    .4758997   .27593654
                      1050 1998  -.06554799   .23807953
                      1050 1999  -.22646667    .1490535
                      1050 2000  -.51089996   -.1512182
                      1050 2001      1.3783  -.14019759
                      1050 2002  -.45259395  -.23286048
                      1050 2003   -.1207081     .270958
                      1050 2004   1.0573485   .07992776
                      1050 2005    .6406756  .020444775
                      1050 2006     .518945   .11232558
                      1050 2007   .19068027  .021447353
                      1050 2008   -.7832993  -.36922345
                      1050 2009    .6275314   .25465235
                      1050 2010   .50596076   .14531092
                      1050 2011 -.071691945  .018083747
                      1050 2012    .7911928   .15730585
                      1050 2013    .6220166   .32015085
                      1050 2014  -.04039004   .13274422
                      1050 2015   -.5122915  .007099495
                      1072 1973           .  -.21608047
                      1072 1974   -.8257936   -.3325179
                      1072 1975   .27173272    .3083514
                      1072 1976     1.59029      .18971
                      1072 1977    .4249374  -.13959704
                      1072 1978    .1759901  -.04060716
                      1072 1979   .09179108    .0681949
                      end
                      
                      * perform test regressions to generate results for observations 10 and 90
                      * so you can confirm the rangestat results 
                      regress Re_Rf Rm_Rf if gvkey == gvkey[10] & inrange(fyear, fyear[10]-4, fyear[10])
                      regress Re_Rf Rm_Rf if gvkey == gvkey[90] & inrange(fyear, fyear[90]-4, fyear[90])
                      
                      * now repeat for all observations in the data
                      rangestat (reg) Re_Rf Rm_Rf, interval(fyear -4 0) by(gvkey)
                      
                      * confirm that results for obs 10 and 90 match the ones above
                      list gvkey fyear reg_nobs-se_cons if _n == 10 | _n == 90
                      and the results:

                      Code:
                      . 
                      . * perform test regressions to generate results for observations 10 and 90
                      . * so you can confirm the rangestat results 
                      . regress Re_Rf Rm_Rf if gvkey == gvkey[10] & inrange(fyear, fyear[10]-4, fyear[10])
                      
                            Source |       SS           df       MS      Number of obs   =         5
                      -------------+----------------------------------   F(1, 3)         =      1.47
                             Model |  .171504392         1  .171504392   Prob > F        =    0.3119
                          Residual |   .34970027         3  .116566757   R-squared       =    0.3291
                      -------------+----------------------------------   Adj R-squared   =    0.1054
                             Total |  .521204661         4  .130301165   Root MSE        =    .34142
                      
                      ------------------------------------------------------------------------------
                             Re_Rf |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
                      -------------+----------------------------------------------------------------
                             Rm_Rf |   .7509337   .6190865     1.21   0.312    -1.219276    2.721143
                             _cons |  -.2119944   .1530098    -1.39   0.260    -.6989398    .2749511
                      ------------------------------------------------------------------------------
                      
                      . regress Re_Rf Rm_Rf if gvkey == gvkey[90] & inrange(fyear, fyear[90]-4, fyear[90])
                      
                            Source |       SS           df       MS      Number of obs   =         5
                      -------------+----------------------------------   F(1, 3)         =     30.22
                             Model |  1.51518775         1  1.51518775   Prob > F        =    0.0118
                          Residual |  .150438941         3  .050146314   R-squared       =    0.9097
                      -------------+----------------------------------   Adj R-squared   =    0.8796
                             Total |  1.66562669         4  .416406673   Root MSE        =    .22393
                      
                      ------------------------------------------------------------------------------
                             Re_Rf |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
                      -------------+----------------------------------------------------------------
                             Rm_Rf |   2.518596   .4581891     5.50   0.012     1.060434    3.976758
                             _cons |   .1101074   .1019121     1.08   0.359    -.2142222     .434437
                      ------------------------------------------------------------------------------
                      
                      . 
                      . * now repeat for all observations in the data
                      . rangestat (reg) Re_Rf Rm_Rf, interval(fyear -4 0) by(gvkey)
                      
                      . 
                      . * confirm that results for obs 10 and 90 match the ones above
                      . list gvkey fyear reg_nobs-se_cons if _n == 10 | _n == 90
                      
                           +---------------------------------------------------------------------------------------------------+
                           | gvkey   fyear   reg_nobs      reg_r2   reg_adj~2     b_Rm_Rf       b_cons    se_Rm_Rf     se_cons |
                           |---------------------------------------------------------------------------------------------------|
                       10. |  1004    1976          5   .32905383   .10540511    .7509337   -.21199436   .61908649    .1530098 |
                       90. |  1050    2012          5   .90968028    .8795737   2.5185959     .1101074   .45818912   .10191205 |
                           +---------------------------------------------------------------------------------------------------+

                      Comment


                      • #12
                        Could you check your dataex output? This line is not correct, it should be an input command:
                        Code:
                        gvkey fyear (Re_Rf) (Rm_Rf)

                        Comment


                        • #13
                          Originally posted by Robert Picard View Post
                          You did not copy the data example generated by dataex as is because there's no input command.

                          From previous posts, it appears that you want to perform the following regression:
                          Code:
                          regress Re_Rf Rm_Rf
                          and you want to perform this regression on data from the same company within a retrospective window of 5 years that includes the current observation.

                          At a minimum, you should be able to get the results you want for any observation by simply specifying the regression with a condition that selects the correct set of observations to use. See help subscripting, help _variables, and help inrange(). For example, gvkey[10] refers to the value of gvkey for observation 10. Similarly, fyear[10] refers to the value of fyear for observation 10. In the data you posted, observation 10 has a value for gvkey of 1004 and 1976 for fyear. So to generate the results you want for observation 10, you would type:
                          Code:
                          regress Re_Rf Rm_Rf if gvkey == gvkey[10] & inrange(fyear, fyear[10]-4, fyear[10])
                          This type of regression over a rolling window of time is easy to do with rangestat, especially with the recent update that includes a built-in regression function. To install rangestat, type in Stata's Command window:
                          Code:
                          ssc install rangestat
                          Before you try anything, read the help file, it has numerous examples, including one that explains in detail the code below:


                          [/CODE]

                          Hi Robert,

                          I was trying to edit your code which should give me exactly what I want.

                          The original code you typed stands in the following topic, post #11: http://www.statalist.org/forums/foru...tas-for-stocks

                          Code:
                            
                            
                           * ------------ regressions over a window of 6 periods using -rangestat- -------- * define a linear regression in Mata using quadcross() - help mata cross(), example 2 mata: mata clear mata set matastrict on real rowvector myreg(real matrix Xall) {     real colvector y, b, Xy     real matrix X, XX      y = Xall[.,1]                // dependent var is first column of Xall     X = Xall[.,2::cols(Xall)]    // the remaining cols are the independent variables     X = X,J(rows(X),1,1)         // add a constant          XX = quadcross(X, X)        // linear regression, see help mata cross(), example 2     Xy = quadcross(X, y)     b  = invsym(XX) * Xy          return(rows(X), b') } end  * regressions with a constant over a rolling window of 6 periods by permno rangestat (myreg) stockexcessret mktrf, by(permno) interval(time -5 0) casewise  * the Mata function returns first the number of observations and then as many * variables as there are independent variables (plus the constant) for the betas rename (myreg1 myreg2 myreg3) (nobs rs_mktrf rs_cons)  * reject results if the window is less than 6 or if the number of obs < 4 isid permno year by permno: replace rs_mktrf = . if _n < 6 | nobs < 4 by permno: replace rs_cons = . if _n < 6 | nobs < 4 save "rangestat_results.dta", replace  * ----------------- replicate using -rolling- ---------------------------------- use "test_data.dta", clear levelsof permno, local(permno) foreach s of local permno {     rolling _b, window(6) saving(betas_`s', replace) reject(e(N) < 4):  ///        regress stockexcessret mktrf if permno == `s'                 }  clear save "betas.dta", replace emptyok foreach s of local permno {     append using "betas_`s'.dta" } rename end year merge 1:1 permno year using "rangestat_results.dta" isid permno year, sort  gen diff_mktrf =  abs(_b_mktrf - float(rs_mktrf)) gen diff_cons =  abs(_b_cons - float(rs_cons)) summ diff*



                          But what is the essence of the last part with ''replicate using -rolling-'' ?

                          In addition, what type of dataset should I fill in for
                          Code:
                           use "test_data.dta", clear
                          Because I do not have test_data.dta...

                          Comment


                          • #14
                            Since Robert has addressed your immediate questions, let me comment on another problem.

                            I found a similar question from somebody that dates from exactly one year ago, but I did not come any further. I am really new to STATA, which is a big disadvantage for me at the moment.
                            I'm sympathetic to you as a new user of Stata - it's a lot to absorb. And even worse if perhaps you are under pressure to produce some output quickly. Nevertheless, I'd like to encourage you to take a step back from your immediate tasks.

                            When I began using Stata in a serious way, I started, as have others here, by reading my way through the Getting Started with Stata manual relevant to my setup. Chapter 18 then gives suggested further reading, much of which is in the Stata User's Guide, and I worked my way through much of that reading as well. There are a lot of examples to copy and paste into Stata's do-file editor to run yourself, and better yet, to experiment with changing the options to see how the results change.

                            All of these manuals are included as PDFs in the Stata installation (since version 11) and are accessible from within Stata - for example, through the PDF Documentation section of Stata's Help menu. The objective in doing the reading was not so much to master Stata as to be sure I'd become familiar with a wide variety of important basic techniques, so that when the time came that I needed them, I might recall their existence, if not the full syntax, and know how to find out more about them in the help files and PDF manuals.

                            The Stata documentation is really exemplary - there's just a lot of it. The path I followed surfaces the things you need to know to get started in a hurry and to work effectively.

                            Comment


                            • #15
                              Originally posted by William Lisowski View Post
                              Since Robert has addressed your immediate questions, let me comment on another problem.



                              I'm sympathetic to you as a new user of Stata - it's a lot to absorb. And even worse if perhaps you are under pressure to produce some output quickly. Nevertheless, I'd like to encourage you to take a step back from your immediate tasks.

                              When I began using Stata in a serious way, I started, as have others here, by reading my way through the Getting Started with Stata manual relevant to my setup. Chapter 18 then gives suggested further reading, much of which is in the Stata User's Guide, and I worked my way through much of that reading as well. There are a lot of examples to copy and paste into Stata's do-file editor to run yourself, and better yet, to experiment with changing the options to see how the results change.

                              All of these manuals are included as PDFs in the Stata installation (since version 11) and are accessible from within Stata - for example, through the PDF Documentation section of Stata's Help menu. The objective in doing the reading was not so much to master Stata as to be sure I'd become familiar with a wide variety of important basic techniques, so that when the time came that I needed them, I might recall their existence, if not the full syntax, and know how to find out more about them in the help files and PDF manuals.

                              The Stata documentation is really exemplary - there's just a lot of it. The path I followed surfaces the things you need to know to get started in a hurry and to work effectively.
                              Thank you! I already obtained all interesting manuals of STATA. The basics of STATA are very clear to me, but at the moment I am not skilled yet in producing my own codes regarding loops, saving coefficients.

                              At the moment, it's a lot of googling, asking and trying to imitate similar codes by editing it (see the post #13).

                              Thanks for your response ! I appreciate it

                              Comment

                              Working...
                              X