找回密码
 立即注册
查看: 3611|回复: 1

请教一道关于contour plot的问题

[复制链接]
发表于 2017-9-28 04:57:27 | 显示全部楼层 |阅读模式
The random variables X and Y are independent and identically distributed with normal mixture distribution.  The components of the mixture have N(0,1) and N(3,1) distributions with mixing probabilities p1 and p2=1-p1 respectively.  Generate a bivariate random sample from the joint distribution of (X,Y) and construct a contour plot.  Adjust the levels of the contours so that the contours of the second mode are visible.
请问这道题应该怎么做?
回复

使用道具 举报

发表于 2017-9-28 10:27:52 | 显示全部楼层
题目是英文,所以根据猜测来尝试回答:
设P1为0.2,P2为0.8
U<-c(-10:10)
V<-U
Fx<-0.2*dnorm(U,0,1)+0.8*dnorm(V,3,1)
Fy<-0.2*dnorm(U,0,1)+0.8*dnorm(V,3,1)   
Fxy<-tcrossprod(Fx,Fy)     
contour(U, V, Fxy, nlevels = 15)
最后悔画出一个等高图,但是否正确还请自己确定。本问题涉及到概率这个数学问题,有点超出了本人的能力。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|R语言中文网

GMT+8, 2024-11-22 20:36 , Processed in 0.021164 second(s), 17 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表