我正在将分布拟合到给定的data.then,我已经估计了分布的参数,我还使用R中的ecdf()命令绘制了经验cdf。我该怎么做呢?ecdf()命令还能帮助我吗?
发布于 2013-10-15 17:56:39
是的,ecdf可以帮助您。它有一种绘图方法。下面你可以看到正态分布的可能代码。
x <- rnorm(100)
plot(ecdf(x))
lines(seq(-3, 3, by=.1), pnorm(seq(-3, 3, by=.1)), col=2)编辑:您可以使用log-logistic分布函数来做同样的事情。例如,它在actuar包中实现。
# load package
require(actuar)
# check out the parametrization!
?dllogis
# estimate shape and scale from your data
shape <- 20
scale <- 1
# Don't do this. Use your own data instead.
x <- rllogis(100, shape=shape, scale=scale)
# Plotting the empirical distribution function
plot(ecdf(x))
# x-values for plotting distribution function
xvals <- seq(min(x), max(x), length=100)
# plot estimated distribution function with your estimated shape and scale
lines(xvals, pllogis(xvals, shape=shape, scale=scale), col=2)https://stackoverflow.com/questions/19377734
复制相似问题