Announcement

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

  • Export table in format tex from Stata using customized p-values.

    Hello StataList!

    I have the following problem. I want to export a table (for which I'm using de estout command) but my problem is that I want to change the p-values.
    This because I estimate False Discovery Rate (FDR) adjusted p-values (Anderson, 2008) and I have them in a different database (in which I have in one column the original p-value, and in the next one the adjusted p-value).

    Is there a form to export a table directly from stata to tex format in which I can include the originals estimations (for the coefficients) and the new p-values I estimate?


    Thanks you very much!

  • #2
    Code:
    ssc install estout, replace
    Code:
    sysuse auto, clear
    regress mpg weight disp turn, nocons
    *CUSTOM PVALs
    mat pval= (0.0001, 0.10, 0.045)
    mat colnames pval= "`:colnames e(b)'"
    estadd matrix pval= pval
    *ESTTAB WITH CUSTOM PVALs
     esttab ., cells(b(star pvalue(pval) fmt(3))) nose tex
    Res.:

    Code:
    .  esttab ., cells(b(star pvalue(pval) fmt(3))) nose tex
    
    {
    \def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi}
    \begin{tabular}{l*{1}{c}}
    \hline\hline
                &\multicolumn{1}{c}{(1)}\\
                &\multicolumn{1}{c}{mpg}\\
                &           b         \\
    \hline
    weight      &      -0.009\sym{***}\\
    displacement&      -0.019         \\
    turn        &       1.299\sym{*}  \\
    \hline
    \(N\)       &          74         \\
    \hline\hline
    \end{tabular}
    }

    Comment


    • #3
      Thanks for the answer, Andrew! But I still have some doubts.
      The table I want to make has 8 rows and 9 columns. I have a dataset with the corrected p-values in the same order that I want them to appear in the table (the p-value in the position 1,1 of my dataset with the corrected p-values is the p-value that I want to appear in the "position" 1,1 of the table).
      Do you know how I can do that?
      In addition, do you know the specific option of the command estout to make appear the pvalues in the table? It doesn't work for me.

      Thanks very much for the help!


      Comment


      • #4
        #2 shows stars based on the specified p-values. To show the specified p-values:

        Code:
        sysuse auto, clear
        regress mpg weight disp turn, nocons
        *CUSTOM PVALs
        mat pval= (0.0001, 0.10, 0.045)
        mat colnames pval= "`:colnames e(b)'"
        estadd matrix pval= pval
        *ESTTAB WITH CUSTOM PVALs
        esttab ., cells("b(star pvalue(pval) fmt(3) label(Coef.)) pval(fmt(3) label(p-value))") nose label nonum
        Res.:

        Code:
        . esttab ., cells("b(star pvalue(pval) fmt(3) label(Coef.)) pval(fmt(3) label(p-value))") nose label nonum
        
        -------------------------------------------------
                             Mileage (m~)                
                                    Coef.         p-value
        -------------------------------------------------
        Weight (lbs.)              -0.009***        0.000
        Displacement .. in.)       -0.019           0.100
        Turn Circle (ft.)           1.299*          0.045
        -------------------------------------------------
        Observations                   74                
        -------------------------------------------------

        Comment

        Working...
        X