Announcement

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

  • Cholesky Decomposition

    Good morning everyone,

    I'm quite new with Stata and I'm trying to learn as much as I can from Statalist older discussion but I have a problem:
    my goal is, starting from a variance-covariance matrix that has to be uploaded from an Excel file (let's say nxn matrix - e.g.10x10) I need to decompose this matrix using the Cholesky decomposition method (and of course o export the output in Excel).

    Has anyone some suggestion?

    Thank you very much in advance.
    Alberto

  • #2
    It is not clear what your problem is: importing and exporting to Excel or Cholesky decomposition. See

    Code:
    help cholesky
    for the latter.

    Comment


    • #3
      The first row of corrmatrix.xlsx contains the variable names for each column of the matrix: from v1 to v10
      Code:
      import excel corrmatrix.xlsx", first
      mkmat v1-v10,matrix(A)
      matrix list A
      matrix B = cholesky(A)
      matrix list B
      putexcel set B.xlsx
      putexcel A1 = matrix(B)

      Comment


      • #4
        Originally posted by Eric de Souza View Post
        The first row of corrmatrix.xlsx contains the variable names for each column of the matrix: from v1 to v10
        Code:
        import excel corrmatrix.xlsx", first
        mkmat v1-v10,matrix(A)
        matrix list A
        matrix B = cholesky(A)
        matrix list B
        putexcel set B.xlsx
        putexcel A1 = matrix(B)
        Thank you so much Eric!
        The code you sent works perfectly!

        Comment

        Working...
        X