Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: AW: Program for OLS regression coefficients using weights


From   "Martin Weiss" <[email protected]>
To   <[email protected]>
Subject   st: AW: Program for OLS regression coefficients using weights
Date   Thu, 18 Jun 2009 16:18:59 +0200

<> 

Have you had a look at Mata yet? See Kit`s
http://www.stata.com/meeting/fnasug08/baum_StataMata.beamer.FNASUG08.pdf,
slide 50 for an example...



HTH
Martin


-----Ursprüngliche Nachricht-----
Von: [email protected]
[mailto:[email protected]] Im Auftrag von Schnepf S.V.
Gesendet: Donnerstag, 18. Juni 2009 16:17
An: [email protected]
Betreff: st: Program for OLS regression coefficients using weights

Dear Statalist users,

I would need to write a programme that gives me the b coefficients of an OLS
regression, using weights.
This is an easy task if no weights are used with b being (X'X)-1(X'Y):

mat accum xprimex = x
mat vecaccum yprimex = y x
*Transpose
mat xprimey =yprimex'
mat b = inv(xprimex)*(xprimey)
mat list b

However, I would like to estimate b=(X'DX)-1 X'DY, hence applying design
weights.
D is now a diagonal weight matrix.

My sample size is considerably above 800 which creates problems with
matsize. And I find the command matrix glsaccum rather difficult to apply.

Could anyone help?

Many thanks
Sylke V. Schnepf



*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index