Announcement

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

  • Are there functions in Mata doing weighted/GLS cross products? (-glsaccum- , -opaccum-)

    Good afternoon,

    Are there functions in Mata that do weighted/GLS cross products of the form:
    1. X'*S*X = Sum_i (Xi'Si*Xi), where S is a block diagonal matrix with Si on the diagonal, and X is the stacked matrix having the Xi matrices on the top of each other
    2. X'*S*X = Sum_i (Xi'*Ei*Ei'*Xi), where S is a block diagonal matrix with the outer product Ei*Ei' of the vector Ei on the diagonal
    ?

    The eq.(1) above is done in Stata by -matrix glsaccum- and eq.(2) is done by -matrix opaccum-.

    I looked through the help for the Mata functions cross() and quadcross(), but they are able to do only scalar weighting, i.e., they allow S to be only diagonal with scalars on the diagonal.



Working...
X