Announcement

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

  • How to get the mean coefficient and t-statistics and adjusted R square from the regression ?

    After I run the regression as below to estimation of the normal level od discretionary expenditure, there will be 65 mean betas, 65 mean R square for the 50 industries and each industres have many companies . as Zang 2012 in her article mention .

    1- The reported coefficients are the mean values of the coefficients across industry-years .
    2- t-statistics are calculated using the standard errors of the coefficients across industry-years.
    3- The adjusted R square (no. of observatyions) is the mean adjusted R square(no. of observations) across industry-years.

    the questions here How to get the mean coefficient and t-statistics and adjusted R square from the regression ?


    Code:
    .by industry year, sort : reg var9 var3 va5

  • #2
    Look at the -statsby- command. Use it with the -saving()- option, and then calculate the means in the saved data set.

    Comment


    • #3


      Hi, Thank you for your reply. I am trying this as code below , but I thought there is missing . note . how can I do that for each industry and year

      Code:
      . statsby _b e(r2), by (industry) : regress var9 var5 var3
      
      * get mean betas and R2
      collapse (mean) _b_cons _b_var5 _b_var3 ///
      (semean) _se_cons = _b_cons _se_var3 = _b_var3 _se_var5 = _b_var5
      
      * get t-stat for mean betas
      foreach v in cons var3 var5 {
      generate _t_`v' = _b_`v' / _se_`v'
      }
      list
      [/QUOTE]
      Last edited by basiem shattarat; 20 Jan 2015, 09:30.

      Comment


      • #4
        Please show us the results of
        Code:
        statsby _b e(r2), by (industry) saving(tempfile, replace) : regress var9 var5 var3n 
        
        use tempfile, clear
        summarize
        describe
        list in 1/10
        Please also revisit help statsby and the Forum FAQ sections about how to use CODE delimiters. (Your attempted implementation didn't work, unfortunately.)

        Comment


        • #5
          Thanks Stphen , I am trying the code for #4 but here I need run that regression across industry year not just inustry. I use but I get the error == option bysort not allowed
          Code:
          statsby _b e(r2), bysort  industry year saving(tempfile, replace) : regress var9 var5 var3
          
          use tempfile, clear
          summarize
          describe
          list in 1/10

          Comment


          • #6
            As Stata is telling you, -statsby- doesn't have a -bysort- option. It-s a -by- option. Replace your first command with

            Code:
             statsby _b e(r2), by(industry year) saving(tempfile, replace) : regress var9 var5 var3
            and you should get what you need.

            Comment


            • #7
              The problem is that I was lazy and copy/pasted your call to statsby when composing my last post without checking if first. The problem is that you're not using the correct syntax (which revisiting the help file, as requested, would have shown). [NB All I am trying to do is to get you to do what Clyde Schechter recommended that you do.]

              Code:
               statsby  _b  r_sq=(e(r2)), by(industry year) saving(tempfile, replace) : regress var9 var5 var3
                use tempfile, clear
              summarize
              describe
              list in 1/10

              Comment


              • #8
                really I would thank you all for help me to get that point. now its working . but I have question here how can I get the t statistic ?

                I would highly appreciate any help in that

                Comment


                • #9
                  Which t statistic? The one associated with each predictor? If this is the case, then you need to adjust the call to statsby. Read the help file again, and you will see that you can also create 'on the fly' statistics that are defined in terms of the output produced as part of the regression. In the case of regress, you can refer to each coefficient and to its associated standard error. See the help file discussion about the syntax for "exp" (meaning "expression"), and there or elsewhere in the documentation on how to cite specific coefficients and standard errors.

                  Comment

                  Working...
                  X