[R-sig-finance] using yahoo and other data to calculate CAPM and FF betas

Krishna Kumar kriskumar at earthlink.net
Fri Apr 7 05:27:06 CEST 2006


Gabor Grothendieck wrote:

>On 4/6/06, Andrew West <jgalt70 at yahoo.com> wrote:
>  
>
>>I haven't been able to figure
>>out how to prevent the function from crashing when one
>>of the companies in the list has a late start or
>>missing data. Aligning multiple time series into a
>>panel data dataframe is tough for non-programmers like
>>me!
>>    
>>
>
>If t1 and t2 are two ts class time series or two zoo series
>then cbind(t1, t2) will create a multivariate series (2 columns)
>In the case of zoo, merge(t1, t2) will also work.
>
>na.omit(cbind(t1, t2)) or na.omit(merge(t1,t2))
>will eliminate rows that have any NAs in the case of zoo series.
>
>_______________________________________________
>R-sig-finance at stat.math.ethz.ch mailing list
>https://stat.ethz.ch/mailman/listinfo/r-sig-finance
>
>  
>

To add to Gabor's suggestion you could do the following to get an 
approximated series..
so if mydata is a vector with "NA" 's then doing

 >mydata<-approx(mydata,xout=seq(along=mydata))$y

this would approximate the series and then you can do a ts.union

Also there was a very interesting paper that showed that the Fama-French 
effect was not really a anamoly when you estimate using
 Robust regression instead of OLS. I can't remember the reference but it 
was Doug Martin and someone else from UW ...
R has some nice facilities with rrcov to do the robust regressions!!

Best,
Krishna



More information about the R-sig-finance mailing list