1
我正在運行一些測試以嘗試確定我的數據遵循什麼分佈。從我的數據密度來看,我認爲它看起來有點像邏輯分佈。我比使用包MASS來估計分佈的參數。但是,當我將它們繪製在一起時,雖然比正常情況好,但物流仍然不是很好。是否有辦法找到哪種分佈會更好?感謝您的幫助 !圖形擬合分佈
library(quantmod)
getSymbols("^NDX",src="yahoo", from='1997-6-01', to='2012-6-01')
daily<- allReturns(NDX) [,c('daily')]
dailySerieTemporel<-ts(data=daily)
x<-na.omit(dailySerieTemporel)
library(MASS)
(xFit<-fitdistr(x,"logistic"))
# location scale
# 0.0005210570 0.0106366354
# (0.0002941922) (0.0001444678)
xFitEst<-coef(xFit)
plot(density(x))
set.seed(125)
lines(density(rlogis(length(x), xFitEst['location'], xFitEst['scale'])), col=3)
lines(density(rnorm(length(x), mean(x), sd(x))), col=2)
請在代碼中爲所有必需的包添加'library()'語句。我猜你也在這裏使用'xts'或'quantmod'? – Andrie 2012-08-06 14:27:35
感謝您的提醒!我相信quantmod自動加載它使用的其他的!我修改了一下我的問題,因爲我設法將我所做的事情圖表化了。 – 2012-08-06 14:32:23
這是一個類似的問題http://stats.stackexchange.com/questions/33115/whats-the-distribution-of-these-data – Seth 2012-08-06 15:42:16