Announcement

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

  • Alternative to rowjoinbyname

    Is rowjoinbyname a more recent command? In the desktop Stata version 16 the code below works, in the virtual machine I have Stata 15.0 and it gives me the error "matrix operation not found".

    How can I accomplish the same without using it?

    MWE below:

    Code:
    sysuse auto.dta
    
    reg price weight mpg
    mat output = r(table)
    mat list output
    
    matrix estimates = output["b",.]
    matrix standarderrors = output["se",.]
    matrix lowerbound = estimates-1.96*standarderrors
    matrix upperbound = estimates+1.96*standarderrors
    
    matrix rowjoinbyname results = estimates lowerbound upperbound

  • #2
    Equivalently, you may use

    Code:
    matrix results = estimates \ lowerbound \ upperbound

    Comment


    • #3
      Yes, the rowjoinbyname subcommand was introduced in Stata 16. I know that because

      Code:
      help whatsnew15to16
      contains the entry

      1.3.15 What's new in programming
      [...]
      4. New commands matrix rowjoinbyname and matrix coljoinbyname join matrix rows (columns) matched on column (row) names.

      In your specific example, you can just

      Code:
      matrix results = estimates\ lowerbound\ upperbound
      and obtain the same result. However, the confidence intervals (not relying on the crude approximation of 1.96) are already present in r(table), so I fail to see why you would even want that.

      Comment


      • #4
        thank you!

        Comment

        Working...
        X