问题描述
我正在尝试在R中的直方图上添加最合适的法线.现在,我有以下内容:
I'm trying to add a best fit normal over a histogram in R. Right now, I have the following:
x<-table[table$position==1,]$rt
hist(x,breaks=length(x))
现在,我想在此图上绘制一条法线,以允许歪斜和峰度.我怎样才能做到这一点?这就是我的曲线:
And now I'd like to plot a normal curve over this plot which allows for skew and for kurtosis. How can I do this? This is what my curve looks like:
推荐答案
我建议不要在与法线"相同的句子中使用术语歪斜"和峰度",因为法线曲线都没有.也许您正在寻找一个或两个参数连续密度分布,该分布可以与以零为界且右偏的函数相比较?如果是这样,那么您应该考虑a)发布数据,b)考虑在直方图的顶部绘制泊松,对数正态或伽玛密度.
I would suggest not using the terms "skew" and "kurtosis" in the same sentence with "Normal curve", since Normal curves have neither. Perhaps you are looking for one or two parameter continuous density distribution that might be comparable to a function that was bounded at zero and had right skewing? If so then you should think about a) posting the data, b) consider plotting a Poisson, a log-Normal, or a gamma density on top of a histogram.
set.seed(123)
xpois <- trunc(rpois(100, 4))
hist(xpois)
lines(seq(0,10), 100*dpois(seq(0,10), 4))
这篇关于在R中的直方图上添加最合适的法线的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!