[R] WLS regression, lm() with weights as a matrix

Victor11 Yao.Zhao at invesco.com
Thu Jul 14 22:29:27 CEST 2011


Dear All,

I've been trying to run a Weighted Least Squares (WLS) regression:

Dependent variables: a 60*200 matrix (*Rit*) with 200 companies and 60 dates
for each company
Independent variables: a 60*4 matrix (*Ft*) with 4 factors and 60 dates for
each factor
Weights: a 60*200 matrix (*Wit*) with weights for 200 companies and 60 dates
for each company

The WLS regression I would like to run is:

(Wit)*Rit = a*(Wit*F1t) + b*(Wit*F2t) + c*(Wit*F3t) + d*(Wit*F4t) + eit

Ideally, I want to run WLS regressions for each company i (i.e., 200 WLS
regressions in total), in each regression using weights from column i in
matrix *Wit* ,and in the end obtain a 60*4 matrix with coefficients and a
200*60 matrix with residuals.

However, when I run:

/lm(Rit ~ Ft, weights=Wit)/

it fails because weights argument can only be vector not matrix.

I have been searching old posts but couldn't find any solutions. I'm
wondering if there is any other function or way to do this? I would really
appreciate for your help.

Thanks,
Victor

--
View this message in context: http://r.789695.n4.nabble.com/WLS-regression-lm-with-weights-as-a-matrix-tp3668577p3668577.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list