[R] Linear regression repeat for each column
iza.ch1 at op.pl
Sun Jul 21 01:55:10 CEST 2013
I need to calculate abnormal returns for different events applying event study methodology. I must create a market model in order to perform the analysis. I apply regression analysis to get OLS estimators.
I have a problem to create a linear regression which I could repeat for each column in two different data frames (one with explainatory and one with explaning variables). It means that I want to regress column 1 from first data frame with column 1 from second data frame,, clumn two with column two etc. I tried to use the following code:#x is matrix containing stock returns
y is matrix containing market index
t[i] <- lapply(t[i], lm(x[,1]~y[,i]))
but it is not working.
Could anybody help me?
Thanks a lot
More information about the R-help