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

2011-07-15 Thread Victor11
Dear All, Now I am thinking to use a for loop: for (i in 1:200) { /Results/ -lm(R[,i] ~ F, weights=W[,i])} The thing is, I can get WLS regression coefficients and residuals for each company each with unique weight, but I am wondering how to easily combine all coefficients and residuals for

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

2011-07-14 Thread Victor11
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