Announcement

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

  • Export pvarsoc output to latex

    I am running a pvarsoc test. My results are posted below. I'd like to export the test results to latex. Is anyone able to suggest commands to export and create a latex format table of pvarsoc results.


    pvarsoc GDP LE GFCA Unemployment PG, maxlag(3) pvaropts(instlags(1/4))
    Running panel VAR lag order selection on estimation sample
    ...

    Selection order criteria
    Sample: 1986 - 2021 No. of obs = 143
    No. of panels = 4
    Ave. no. of T = 35.750

    +--------------------------------------------------------------------------+
    | lag | CD J J pvalue MBIC MAIC MQIC |
    |-------+------------------------------------------------------------------|
    | 1 | .9999962 70.63821 .6211684 -301.5751 -79.36179 -169.6586 |
    | 2 | .9999955 44.62523 .6881797 -203.517 -55.37477 -115.5727 |
    | 3 | .999998 13.79025 .9652664 -110.2809 -36.20975 -66.3087 |
    +--------------------------------------------------------------------------+

  • #2
    pvarsoc is from the Stata Journal (FAQ Advice #12). The results are stored in matrix r(stats) in r(). You can install estout from SSC and output this matrix.

    Code:
    webuse grunfeld, clear
    pvarsoc invest mvalue kstock, pvaro(instl(4/8))
    mat stats=r(stats)
    *ssc install estout, replace
    esttab matrix(stats), tex mlab(none)
    Res.:

    Code:
    . pvarsoc invest mvalue kstock, pvaro(instl(4/8))
    Running panel VAR lag order selection on estimation sample
    ....
    
     Selection order criteria
     Sample:  1943 - 1953                              No. of obs      =       110
                                                       No. of panels   =        10
                                                       Ave. no. of T   =    11.000
    
      +--------------------------------------------------------------------------+
      |   lag |    CD          J      J pvalue     MBIC       MAIC       MQIC    |
      |-------+------------------------------------------------------------------|
      |     1 |  .9999497   46.01919   .1223806  -123.1981  -25.98081  -65.41266 |
      |     2 |  .9999304   23.46367   .6598702  -103.4493  -30.53633  -60.11022 |
      |     3 |  .9998502   10.02059   .9312322  -74.58805  -25.97941  -45.69534 |
      |     4 |    .99981   2.751243   .9733466  -39.55308  -15.24876  -25.10672 |
      +--------------------------------------------------------------------------+
    
    
     
    . esttab matrix(stats), tex mlab(none)
    
    \begin{tabular}{l*{6}{c}}
    \hline\hline
                &          CD&           J&    J pvalue&        MBIC&        MAIC&        MQIC\\
    \hline
    1           &    .9999497&    46.01919&    .1223806&   -123.1981&   -25.98081&   -65.41266\\
    2           &    .9999304&    23.46367&    .6598702&   -103.4493&   -30.53633&   -60.11022\\
    3           &    .9998502&    10.02059&    .9312322&   -74.58805&   -25.97941&   -45.69534\\
    4           &      .99981&    2.751243&    .9733466&   -39.55308&   -15.24876&   -25.10672\\
    \hline\hline
    \end{tabular}
    Last edited by Andrew Musau; 26 Aug 2024, 17:37.

    Comment


    • #3
      Thank you Andrew. Is there any way I can fix the lack of leading zeros before the decimal points in J pvalue figures?

      Comment


      • #4
        Code:
        webuse grunfeld, clear
        pvarsoc invest mvalue kstock, pvaro(instl(4/8))
        mat stats=r(stats)
        *ssc install estout, replace
        esttab matrix(stats, fmt(a7)), tex mlab(none)
        Res.:

        Code:
        . esttab matrix(stats, fmt(a7)), tex mlab(none)
        
        \begin{tabular}{l*{6}{c}}
        \hline\hline
                    &          CD&           J&    J pvalue&        MBIC&        MAIC&        MQIC\\
        \hline
        1           &   0.9999497&   46.019195&   0.1223806&  -123.19810&  -25.980805&  -65.412664\\
        2           &   0.9999304&   23.463673&   0.6598702&  -103.44930&  -30.536327&  -60.110221\\
        3           &   0.9998502&   10.020592&   0.9312322&  -74.588054&  -25.979408&  -45.695337\\
        4           &   0.9998100&   2.7512429&   0.9733466&  -39.553080&  -15.248757&  -25.106722\\
        \hline\hline
        \end{tabular}

        Comment

        Working...
        X