Hello I have 9 dataframes that look like this:
RET mktrf smb hml rf
1 0.012930 0.0120 0.0005 -0.0003 0.00018
2 0.001054 -0.0023 -0.0098 0.0019 0.00018
3 0.020356 0.0121 0.0012 -0.0028 0.00018
4 -0.002522 -0.0085 -0.0011 -0.0015 0.00018
5 -0.031034 -0.0233 -0.0007 -0.0040 0.00018
6 0.028470 0.0213 0.0012 0.0001 0.00018
Above is an example of one of them--all of them are in the exact same format.
I need the same regression for them I tried this:
dflist=list(cvx,csco,trv,unh,gs,nke,v,aapl,wba)
# for loop for normal returns
fama_summaries=list()
for (i in dflist){
ri_rf = (i[,1]-i[,5])
capm = (i[,2]-i[,5])
fama=lapply(i,function(x) lm(ri_rf ~ smb + hml + capm, data =i))
append(fama_summaries,values=summary(fama))
}
But I'm not getting any results. I need the summaries and the coefficients saved for each regression so I can use them later... Can someone help me out?