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