本文介绍了将指数分布覆盖到直方图上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何将指数分布覆盖在时间间隔的直方图上?直方图看起来像是指数分布.当我尝试以类似于叠加法线的方式创建直方图时,得到以下信息:

How can i overlay an exponential distribution on a histogram of time intervals? The histogram looks like an exponential distribution.When I try to create the histogram in a similar way to superimposing a normal curve I get the following:

Error in xy.coords(x, y) : 'x' and 'y' lengths differ

我可以自己创建直方图,直方图的x轴从0到70.我可以自己创建指数分布曲线,但x轴从0到1.

I can create the histogram on its own which has an x axis from 0 to 70. And I can create an exponential distribution curve on its own but its x axis goes from 0 to 1.

我正在使用hist(t),其中t是直方图以秒为单位的时间列表和curve(dexp(x,rate=0.09))用于指数分布.

I am using hist(t) where t is a list of times in seconds for the histogramand curve(dexp(x,rate=0.09)) for the exponential distribution.

推荐答案

请确保在hist中使用prob = TRUE,在curve

z <- rexp(300,rate = 0.09)
hist(z, prob = TRUE)
curve(dexp(x, rate = 0.09), col = 2, lty = 2, lwd = 2, add = TRUE)

这篇关于将指数分布覆盖到直方图上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-11 00:33