Announcement

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

  • Multiple regression with one-sided p-values

    Hello,
    I am working on an assignment which involves the presentation of multiple regressions in tables. So far I managed to create the regressions and to put them on display using esttab, but I have some formatting requirements that confine me. I know that the one-sided p-value of a beta coef in a regression is basically the two sided p-value divided by 2 but I have to use the one sided to decide where to put the stars.
    I have a stored model called model_1 and i am trying to format it like that:
    estout model_1, cells(b beta(star fm(2)) t(abs par)) legend starlevels(* .05 ** .01) drop(_cons)

    this one is taking however the two-sided p-values. I also tried to access the e() array to get the e(p_u) value using:

    estout model_1, cells(b beta(pvalue(p_u)star fm(2)) t(abs par)) legend starlevels(* .05 ** .01) drop(_cons)

    but it seems empty. Do you have any idea how to achieve that final bit of formatting?
    PS: I am doing a simple OLS Regression with

    regress x_1 x_2 x_3 x_4, beta

    Kind regards,
    Todor Kostov

  • #2
    I managed to do the computation myself, but I still cannot get the results in the table. I have multiple regressions and I need to produce multiple tables: So far i have:

    local todor =_b[ independent_var1 ] / _se[ independent_var1 ]
    di ttail(e(df_r), abs(`todor'))

    Now I have the one sided p-value for the beta coef of a variable. How can I replace the p-values for my variables in the model?

    Kind Regards,
    Todor

    Comment


    • #3
      No idea on the details, but estout is user-written (probably) from the SSC, as you are asked to explain. From a quick glance into the help file, it seems the pvalues() sub-option is what you need.

      Best
      Daniel

      Comment


      • #4
        Hi Daniel,
        i noticed that too. The problem is that pvalues() reads the e() array so i have to put the one-sided p-values in the array. Which is the problem because i have to compute them first for all my models. Still working on it. I would appreciate any help.

        Thanks in advance,
        Todor Kostov

        Comment


        • #5
          You can make these calculations with matrices using Mata and store the results in e().

          Run this code once

          Code:
          *! version 1.0.0 05jan2015 Daniel Klein
          
          pr MyPvalues
              vers 12.1
              
              args myname
              m : GetMyPvalues("`myname'")
          end
          
          vers 12.1
          m :
          void GetMyPvalues(string scalar myname)
          {
              real matrix b, V, P
              real scalar df_r
              string matrix names
              
              b = st_matrix("e(b)")
              V = st_matrix("e(V)")
              df_r = st_numscalar("e(df_r)")
              
              P = b' :/ sqrt(diagonal(V))
              P = ttail(df_r, abs(P))
              
              myname = "e(" + myname + ")"
              st_matrix(myname, P')
              names = st_matrixcolstripe("e(b)")
              st_matrixcolstripe(myname, names)
          }
          end
          You can then run MyPvalues myname to store in e(myname) the one sided p-values from the latest (simple) regression model.

          Here is an example

          Code:
          sysuse auto
          
          reg price mpg turn length
          MyPvalues mypvalues
          
          estout ,c(b(star pval(mypvalues))) legend
          Best
          Daniel

          Comment

          Working...
          X