Announcement

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

  • Create table after generalised logit model (gologit2)

    Dear All,

    I am trying to create a table following the use of the command gologit2, a command written by Richard Williams, https://journals.sagepub.com/doi/abs...867X0600600104 , but I find it difficult to use the collect and table commands to create and export tables from the gologit2 command.

    When running e.g. the ordered logit model, due to the proportional odds assumption, there is only one set of estimated parameters (e.g. _r_b and _r_se) for each explanatory variable. However, the generalised order logit model allows for different estimated parameters for each level of the explained variable.
    When looking at the result window in Stata after running the code:
    Code:
    use https://www.stata-press.com/data/r18/nhanes2d.dta
    gologit2 region age sex, auto gamma(m1) or
    The table is as expected, one subset of estimated parameters for each region, NE, MW and S. However, when I
    Code:
    etable
    the results, all the results are there but the regional separation disappears. When I use
    Code:
    db tables
    I see that the levels of the variable region is there, but I am not able to create one column of results from each of these levels of the variable region.

    I had hoped that I could export a table with 3 columns, one for each region, with estimated coefficients (_r_b) and estimated standard errors (_r_se). However, I have not had any luck with this. Has anyone else had a similar problem? Or is there anyone out there who know how to create this type of tables after running the gologit2 regression?

    In addition, there are two tables following gologit2, first the regression table as discussed above, and then a second table called “alternative parameterization”. This table is stored in ereturn, with estimated coefficients, e(gamma_b), and estimated standard error, e(gamma_se). Can this table be sent to the Tables Builder using db tables?

    I am thankful for all comments and suggestions!

  • #2
    Thanks for the working example.

    etable does not show the equation names by default, use option showeq to see the equations.

    The layout specified by etable can be seen in the tables dialog db tables or via the output from collect layout. This layout puts the column equations coleq in the table's row specification, you can move coleq to the column specification. In the following I changed the layout by moving coleq from the row specification to replace etable_depvar in the column specification.

    Code:
    use https://www.stata-press.com/data/r18/nhanes2d.dta
    gologit2 region age sex, auto gamma(m1) or
    * show equations
    etable, showeq
    * replay table with layout information
    collect layout
    * change layout to put the equations in the columns
    collect layout (colname#result[_r_b _r_se]) (coleq#stars[value])
    Here is the resulting table.
    Code:
    -----------------------------------
                   NE      MW      S   
    -----------------------------------
    Age (years)   0.999   1.003   1.001
                (0.001) (0.001) (0.001)
    Sex           1.018   1.018   1.018
                (0.036) (0.036) (0.036)
    Intercept     4.009   0.941   0.314
                (0.359) (0.074) (0.027)
    -----------------------------------
    For the table of alternative parameters, restore your m1 estimation results, use _coef_table, or to replay the alternative results table, then use etable.
    Code:
    * restore alternative parameterization
    estimates restore m1
    * replay the results
    _coef_table, or
    * customizable estimation table
    etable, showeq equations(Beta Gamma_2 Gamma_3)
    Here is the resulting table.
    Code:
    ---------------------
                   region
    ---------------------
    Beta                 
      Age (years)   0.999
                  (0.001)
      Sex           1.018
                  (0.036)
    Gamma_2              
      Age (years)   1.004
                  (0.001)
    Gamma_3              
      Age (years)   1.002
                  (0.002)
    N               10351
    ---------------------

    Comment


    • #3
      Thank you very much, Jeff!

      This saves me for quite a bit of work in text-files!

      Comment

      Working...
      X