Statalist


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

st: Program for OLS regression coefficients using weights


From   "Schnepf S.V." <[email protected]>
To   "[email protected]" <[email protected]>
Subject   st: Program for OLS regression coefficients using weights
Date   Thu, 18 Jun 2009 15:17:04 +0100

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/



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