Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable grouping of regressions as in esttab's mgroups #61

Merged
merged 9 commits into from Apr 19, 2020
Merged

Enable grouping of regressions as in esttab's mgroups #61

merged 9 commits into from Apr 19, 2020

Conversation

greimel
Copy link
Collaborator

@greimel greimel commented Apr 18, 2020

  • implementation
  • tests
  • docs

Example 1

  df = dataset("datasets", "iris")
  df[!,:SpeciesDummy] = categorical(df[!,:Species])

  rr1 = reg(df, @formula(SepalLength ~ SepalWidth + fe(SpeciesDummy)))
  rr2 = reg(df, @formula(SepalWidth ~ SepalLength + PetalLength + fe(SpeciesDummy)))
  rr3 = reg(df, @formula(SepalLength ~ SepalWidth + PetalLength + PetalWidth + fe(SpeciesDummy))) 
  rr4 = reg(df, @formula(SepalWidth ~ SepalLength + PetalLength + PetalWidth + fe(SpeciesDummy)))
  rr5 = reg(df, @formula(SepalWidth ~ SepalLength + PetalLength + PetalWidth + fe(SpeciesDummy)))
    
  reg_vec = rr1,rr2,rr3,rr4,rr5
  regtable(reg_vec...; groups=["grp1" "grp1" "grp2" "grp2" "grp3"], renderSettings = asciiOutput())  

gives

---------------------------------------------------------------------------
                         grp1                      grp2              grp3  
               ------------------------   ----------------------   --------
               SepalLength   SepalWidth   SepalLength        SepalWidth    
               -----------   ----------   -----------   -------------------
                       (1)          (2)           (3)        (4)        (5)
---------------------------------------------------------------------------
SepalWidth        0.804***                   0.496***                      
                   (0.106)                    (0.086)                      
SepalLength                    0.377***                 0.378***   0.378***
                                (0.071)                  (0.066)    (0.066)
PetalLength                      -0.042      0.829***    -0.188*    -0.188*
                                (0.085)       (0.069)    (0.083)    (0.083)
PetalWidth                                    -0.315*   0.626***   0.626***
                                              (0.151)    (0.123)    (0.123)
---------------------------------------------------------------------------
SpeciesDummy           Yes          Yes           Yes        Yes        Yes
---------------------------------------------------------------------------
Estimator              OLS          OLS           OLS        OLS        OLS
---------------------------------------------------------------------------
N                      150          150           150        150        150
R2                   0.726        0.570         0.867      0.635      0.635
---------------------------------------------------------------------------

Example 2

  regtable(reg_vec...; groups=["grp1" "grp1" "grp2" "grp2" "loooong grp3"], renderSettings = asciiOutput())  
--------------------------------------------------------------------------------
                         grp1                      grp2            looooong grp3
               ------------------------   ----------------------   -------------
               SepalLength   SepalWidth   SepalLength          SepalWidth       
               -----------   ----------   -----------   ------------------------
                       (1)          (2)           (3)        (4)             (5)
--------------------------------------------------------------------------------
SepalWidth        0.804***                   0.496***                           
                   (0.106)                    (0.086)                           
SepalLength                    0.377***                 0.378***        0.378***
                                (0.071)                  (0.066)         (0.066)
PetalLength                      -0.042      0.829***    -0.188*         -0.188*
                                (0.085)       (0.069)    (0.083)         (0.083)
PetalWidth                                    -0.315*   0.626***        0.626***
                                              (0.151)    (0.123)         (0.123)
--------------------------------------------------------------------------------
SpeciesDummy           Yes          Yes           Yes        Yes             Yes
--------------------------------------------------------------------------------
Estimator              OLS          OLS           OLS        OLS             OLS
--------------------------------------------------------------------------------
N                      150          150           150        150             150
R2                   0.726        0.570         0.867      0.635           0.635
--------------------------------------------------------------------------------

@greimel greimel changed the title Enable grouping of regressions as in esttab's mgroups WIP: Enable grouping of regressions as in esttab's mgroups Apr 18, 2020
@greimel greimel changed the title WIP: Enable grouping of regressions as in esttab's mgroups Enable grouping of regressions as in esttab's mgroups Apr 19, 2020
@greimel
Copy link
Collaborator Author

greimel commented Apr 19, 2020

This is ready for review. See #63 for what is still to be improved in separate PRs. I will not tackle this for now because I don't currently need this.

@jmboehm jmboehm self-requested a review April 19, 2020 19:38
Copy link
Owner

@jmboehm jmboehm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great.

@jmboehm jmboehm merged commit 16a6544 into jmboehm:master Apr 19, 2020
@greimel greimel deleted the grouping branch April 20, 2020 07:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants