Announcement

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

  • How to explain the results of t2way5 i.e. Tukey's Two-Way Analysis by Medians

    Dear Stata users,

    Nick Cox had written a command named -t2way5- (SSC) to execute Tukey's Two-Way Analysis by Medians. It gives results that seems interesting, however I can't fully appreciate it. I also cannot find more materials about the Tukey's Two-Way Analysis by Medians. What's the difference between Tukey's model and log-linear model that is usually used to fit contingency table?
    https://ideas.repec.org/c/boc/bocode....html#download

    Code:
    webuse citytemp2
    table region agecat, cont(media tempjan)
    t2way5 region agecat, summari(tempjan)
    Code:
    . table region agecat, cont(media tempjan)
    
    -------------------------------
    Census    |       agecat      
    Region    | 19-29  30-34    35+
    ----------+--------------------
           NE |  23.5   29.6   31.3
      N Cntrl |  20.2   25.5  29.55
        South |  39.2   50.6   65.7
         West |  44.6   54.9   57.2
    -------------------------------
    
    
    . t2way5 region agecat, summari(tempjan)
    
    Grand effect:      29.6
    
    Row       Label         Effect
    ------------------------------
    1         NE                0
    2         N Cntrl       -2.35
    3         South            21
    4         West           25.3
    
    Col       Label         Effect
    ------------------------------
    1         19-29         -10.3
    2         30-34             0
    3         35+        2.299999

  • #2
    Median polish was a major emphasis in Tukey, J.W. 1977. Exploratory Data Analysis. Reading, MA: Addison-Wesley and in several books and papers in the late 1970s and early 1980s, although it dropped from view fairly quickly after that. It is closer to analysis of variance than to log--linear models. The "model" underlying two-way median polish is

    outcome = grand effect + row effect + column effect

    where the "parameters" are estimated iteratively by taking out medians overs rows and columns, If I wanted something similar now I would fire up quantile regression with indicator variables as predictors.

    I don't think I've looked at t2way5 for 20 years or so.

    Comment


    • #3
      Thank you Nick. By the way, I report the result produced by running -qreg-.

      Code:
      . webuse citytemp2
      . qreg tempjan i.region i.agecat, nolog
      
      Median regression                                   Number of obs =        954
        Raw sum of deviations  5625.05 (about 31.299999)
        Min sum of deviations   1917.6                    Pseudo R2     =     0.6591
      
      ------------------------------------------------------------------------------
           tempjan |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
      -------------+----------------------------------------------------------------
            region |
          N Cntrl  |  -2.799999   .6636831    -4.22   0.000    -4.102457   -1.497541
            South  |         20   .6785422    29.47   0.000     18.66838    21.33162
             West  |       24.8   .6813484    36.40   0.000     23.46288    26.13713
                   |
            agecat |
            30-34  |   8.299999   .4865776    17.06   0.000     7.345106    9.254893
              35+  |       11.3   .6613578    17.09   0.000      10.0021    12.59789
                   |
             _cons |       21.1   .6084684    34.68   0.000      19.9059     22.2941
      ------------------------------------------------------------------------------

      Comment


      • #4
        Exploratory Data Analysis in R by Manuel “Manny” Gimond
        https://mgimond.github.io/ES218/Week...d...%20More%20

        Comment

        Working...
        X