Announcement

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

  • View or create design matrix?

    I wonder if anyone knows how to view/extract the implied design matrix for a given regression model specification?

  • #2
    Isn't that just the matrix containing your regressors and possibly constant?

    Comment


    • #3
      It is, but this would need expansion for categorical variables and interactions, if any. It can be extended to include multilevel structures, too. I don't think it's a difficult concept but I was hoping to find an automated solution make it for me. Perhaps I need to be a bit less lazy.

      Comment


      • #4
        I do not know an automatic way of generating this matrix. You can always use the -xi- prefix to create indicators.

        Code:
        sysuse auto, clear
        qui regress price mpg weight i.rep78, nocons
        xi: mkmat mpg weight i.rep78 if e(sample), matrix(X)
        mat l X

        Comment


        • #5
          Thanks Andrew, that's pretty helpful.

          Comment

          Working...
          X