Announcement

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

  • panelsetup() fails when id column is not sorted

    The title is self-explanatory; Here is an example

    Code:
    version 15
    
    clear mata
    
    mata :
    
    // data matrix
    X = runiform(10, 3)
    
    // identifier; not sorted
    id1 = J(2, 1, (1::5))
    
    // identifier; sorted
    id2 = sort(id1, 1)
    
    // info for id1; unexpected
    info1 = panelsetup((id1, X), 1)
    info1
    
    // info for id2; expected
    info2 = panelsetup((id2, X), 1)
    info2
    
    end
    The output

    Code:
    . clear mata
    
    . 
    . mata :
    ------------------------------------------------- mata (type end to exit) ------------------------------------------------------------------------------------------------------------------------------------------------------
    : 
    : // data matrix
    : X = runiform(10, 3)
    
    : 
    : // identifier; not sorted
    : id1 = J(2, 1, (1::5))
    
    : 
    : // identifier; sorted
    : id2 = sort(id1, 1)
    
    : 
    : // info for id1; unexpected
    : info1 = panelsetup((id1, X), 1)
    
    : info1
             1    2
         +-----------+
       1 |   1    1  |
       2 |   2    2  |
       3 |   3    3  |
       4 |   4    4  |
       5 |   5    5  |
       6 |   6    6  |
       7 |   7    7  |
       8 |   8    8  |
       9 |   9    9  |
      10 |  10   10  |
         +-----------+
    
    : 
    : // info for id2; expected
    : info2 = panelsetup((id2, X), 1)
    
    : info2
            1    2
        +-----------+
      1 |   1    2  |
      2 |   3    4  |
      3 |   5    6  |
      4 |   7    8  |
      5 |   9   10  |
        +-----------+
    
    : 
    : end
    --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    
    . 
    end of do-file
    I do not expect this from the documentation and I find it highly irritating. Any thoughts?

    Best
    Daniel
Working...
X