2014-11-04 92 views
1

我想用regstat之類的東西來回歸測試版的coffecients。我的Matlab代碼看起來像:Matlab迴歸返回beta coffecient不正確?

%get stock 
sym = 'F' 
%calculaltes returns with output of standard Open High Low Close 
[o,h,l,clS]=YahooGetData(sym, priords, now,'d') 
y = diff(clS) 

%index like S&P 500 
symIdx='^GSPC' 
[o,h,l,clI]=YahooGetData(sym, priords, now,'d') 
x = diff(clI) 

mdl = regstats(x,y) 

無論我使用什麼股票代碼,我的beta版咖啡總是返回1和0。這有什麼理由嗎?你覺得我做錯了什麼?我也使用polyfit獲得相同的結果。

感謝

+0

如果這是Matlab,那麼它不是R. – 2014-11-04 20:34:52

回答

0

戇大,我換成:

retIdx,o,h,l,clI]=YahooGetData(symIdx, priords, now,'d') 

不使用符號。 DOH!對不起,