Linear regression repeat for each column
Sure. Read the Posting Guide, and provide a reproducible example with sample data.
I suspect the basic idea will be to merge the data frames and then setup the model to refer to the desired columns.
---------------------------------------------------------------------------
Jeff Newmiller The ..... ..... Go Live...
DCN:<jdnewmil at dcn.davis.ca.us> Basics: ##.#. ##.#. Live Go...
Live: OO#.. Dead: OO#.. Playing
Research Engineer (Solar/Batteries O.O#. #.O#. with
/Software/Embedded Controllers) .OO#. .OO#. rocks...1k
---------------------------------------------------------------------------
Sent from my phone. Please excuse my brevity.
"iza.ch1" <iza.ch1 at op.pl> wrote:
Hi everyone 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 i<-1:length(x) t[i] <- lapply(t[i], lm(x[,1]~y[,i])) but it is not working. Could anybody help me? Thanks a lot Iza
______________________________________________ R-help at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.