离散化连续概率分布 [英] Discretizing a continuous probability distribution

查看:165
本文介绍了离散化连续概率分布的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

认识到这可能和编码问题一样是统计问题,假设我有一个使用Distributions.jl创建的正态分布:

Recognizing that this may be as much a statistical question as a coding question, let's say I have a normal distribution created using Distributions.jl:

using Distributions

mydist = Normal(0, 0.2)

我是否应该有一个很好的,直接的方法来离散化这种分布,以便获得与PDF相对的PMF?

Is there a good, straightforward way that I should go about discretizing such a distribution in order to get a PMF as opposed to a PDF?

在R中,我发现执行器软件包中包含一个离散化连续分布的函数.我找不到与朱莉娅相似的东西,但以为我会在自己动手之前先检查一下.

In R, I found that the actuar package contains a function to discretize a continuous distribution. I failed to find anything similar for Julia, but thought I'd check here before rolling my own.

推荐答案

没有内置函数可以执行此操作,但是您可以将范围对象与cdfdiff函数结合使用来计算值:

There isn't an inbuilt function to do it, but you can use a range object, combined with the cdf and diff functions to compute the values:

using Distributions
mydist = Normal(0, 0.2)
r = -3:0.1:3
d = diff(cdf(mydist, r))

这篇关于离散化连续概率分布的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆