简体   繁体   English

绘制泊松分布的概率质量函数

[英]Plotting a probability mass function for a poisson distribution

uppose that i have a poisson distribution with mean of 6 i would like to plot a probability mass function which includes an overlay of the approximating normal density. 假设我具有均值为6的泊松分布,我想绘制一个概率质量函数,其中包括近似法线密度的叠加层。

This is what i have tried 这就是我尝试过的

 plot( dpois( x=0:10, lambda=6 ))

this produces 这产生

在此处输入图片说明

which is wrong since it doesnt contain an overlay of approxiamating noral density 这是错误的,因为它不包含近似正常密度的覆盖

How do i go about this? 我该怎么办?

Something like what you seem to be asking for (I'm outlining the commands and the basic ideas, but checking the help on the functions and trying should fill in the remaining details): 类似于您似乎要的东西(我概述了命令和基本思想,但是检查功能的帮助并尝试应填写其余的详细信息):

  1. taking a wider range of x-values (out to at least 13 or so) and use xlim to extend the plot slightly into the negatives (maybe to -1.5 ) and 取更大范围的x值(至少13个左右),然后使用xlim将图略微扩展到负值(也许到-1.5 ),然后

  2. plotting the pmf of the Poisson with solid dots (similar to your command but with pch=16 as an argument to plot) with a suitable color, then 用合适的颜色用实心点(类似于您的命令,但以pch=16作为绘图的参数)绘制泊松的pmf,然后

  3. call points with the same x and y arguments as above and have type=h and lty=3 to get vertical dotted lines (to give a clear impression of the relative heights, somewhat akin to the appearance of a Cleveland dot-chart); 具有与上面相同的x和y参数并具有type=hlty=3调用points以获取垂直虚线(以给出相对高度的清晰印象,有点类似于克利夫兰点图的外观); I'd use the same colour as the dots or a slightly lighter/greyer version of the dot-colour 我会使用与圆点相同的颜色,或者使用较浅/灰色的圆点颜色

  4. use curve to draw the normal curve with the same mean and standard deviation as the Poisson with mean 6 (see details at the Wikipedia page for the Poisson which gives the mean and variance), but across the wider range we plotted; 使用curve绘制均值和标准偏差与均值6的泊松数相同的正态曲线(请参阅Wikipedia页面上关于泊松数的平均值和方差),但要绘制的范围更广; I'd use a slightly contrasting colour for that. 为此,我将使用略有对比的颜色。

  5. I'd draw a light x-axis in (eg using abline with the h argument) 我会在其中绘制一个浅x轴(例如,将ablineh参数一起使用)

Putting all those suggestions together: 将所有这些建议放在一起:

均值6的泊松pmf和均值和标准差相同的正态曲线

(However, while it's what you're asking for it's not strictly a suitable way to compare discrete and continuous variables since density and pmf are not on the same scale, since density is not probability -- the "right" comparison between a Poisson and an approximating normal would be on the scale of the cdfs so you compare like with like -- they'd both be on the scale of probabilities then) (但是,尽管这是您要的,但严格来说,这并不是比较离散变量和连续变量的合适方法,因为密度和pmf不在同一范围内,因为密度不是概率-泊松与近似法线将在cdfs的范围内,因此您可以像like一样进行比较-然后它们都在概率的范围内)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM