模拟联合累积分布函数中的样本? [英] Simulate samples from a joint cumulative distribution function?

查看:156
本文介绍了模拟联合累积分布函数中的样本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个联合密度函数,用于两个独立变量X和Y.现在,我想从此分布中采样新的x,y.

I have a joint density function for two independent variables X and Y. And I now want to sample new x,y from this distribution.

我认为我要做的是找到联合累积分布,然后以某种方式抽样.我有点知道如何在一维中执行此操作,但是我发现很难理解如何在二维中执行此操作.

What I believe I have to do is to find the joint cumulative distribution and then somehow sample from it. I kinda know how to do this in 1D, but I find it really hard to understand how to do it in 2D.

我还使用了matlab函数cumtrapz来找到累积分布函数以上pdf.

I also used the matlab function cumtrapz to find the cumulative distribution function for the above pdf.

请明确一点,我要做的是从该经验分布中采样随机值x,y.

Just to be clear, what i want to do is to sample random values x,y from this empirical distribution.

有人可以在这里向我指出正确的方向吗?!

Can someone please point me in the right direction here?!

编辑:我有数据值,并且使用 [pdf bin] = hist3([N Y])

I have data values and I use [pdf bins] = hist3([N Y])

然后我将pdf规范化并做

I then normalize the pdf and do

cumulativeDistribution = cumtrapz(pdfNormalize)

cumulativeDistribution = cumtrapz(pdfNormalize)

是的(在下面的评论中)X,Y应该是独立的.

And yes (to the comment below) X,Y are suppose to be independent.

推荐答案

如果您知道如何对1D分布进行采样,则可以将其扩展到2D.为 X 创建边际分布.从中获取一个样本,例如 X 1 .然后在2D分布中修复一个变量X = X 1 并为 Y 采样,即从中采样 Y 一维分布f XY ( X 1 Y ).

If you know how to sample a distribution in 1D then you can extend it to 2D. Create the marginal distribution for X. Take a sample from that, say X1. Then in your 2D distribution fix one variate X=X1 and sample for Y, i.e., sample Y from 1D distribution fXY(X1, Y).

这篇关于模拟联合累积分布函数中的样本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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