Announcement

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

  • J(*,*,*) function

    Hi all,
    Does anyone know why using the J(*,*,*) function results in a matrix that looks as if it is a triangular matrix? For example, typing
    Code:
    . matrix D = J(5,5,10)
    . matlist D
    gives this:
    | c1 c2 c3 c4 c5
    -------------+-------------------------------------------------------
    r1 | 10
    r2 | 10 10
    r3 | 10 10 10
    r4 | 10 10 10 10
    r5 | 10 10 10 10 10


    Thank you,
    Stan

  • #2
    That's just the way Stata displays symmetric matrices. It's all there, though.

    .ÿ
    .ÿversionÿ16.0

    .ÿ
    .ÿtempnameÿM

    .ÿmatrixÿdefineÿ`M'ÿ=ÿJ(5,ÿ5,ÿ10)

    .ÿmatrixÿlistÿ`M'

    symmetricÿ__000000[5,5]
    ÿÿÿÿc1ÿÿc2ÿÿc3ÿÿc4ÿÿc5
    r1ÿÿ10
    r2ÿÿ10ÿÿ10
    r3ÿÿ10ÿÿ10ÿÿ10
    r4ÿÿ10ÿÿ10ÿÿ10ÿÿ10
    r5ÿÿ10ÿÿ10ÿÿ10ÿÿ10ÿÿ10

    .ÿ
    .ÿmatrixÿdefineÿ`M'[1,ÿ5]ÿ=ÿ.

    .ÿmatrixÿlistÿ`M'

    __000000[5,5]
    ÿÿÿÿc1ÿÿc2ÿÿc3ÿÿc4ÿÿc5
    r1ÿÿ10ÿÿ10ÿÿ10ÿÿ10ÿÿÿ.
    r2ÿÿ10ÿÿ10ÿÿ10ÿÿ10ÿÿ10
    r3ÿÿ10ÿÿ10ÿÿ10ÿÿ10ÿÿ10
    r4ÿÿ10ÿÿ10ÿÿ10ÿÿ10ÿÿ10
    r5ÿÿ10ÿÿ10ÿÿ10ÿÿ10ÿÿ10

    .ÿ
    .ÿexit

    endÿofÿdo-file


    .ÿ

    Comment


    • #3
      Note also that the output of
      Code:
      help matrix list
      tells us that the nohalf option

      specifies that, even if the matrix is symmetric, the full matrix be printed.

      Comment


      • #4
        Thank you, both.

        Comment

        Working...
        X