請問如何畫出二元常態分配的立體圖形

673 views
Skip to first unread message

statisti...@gmail.com

unread,
Oct 14, 2013, 9:06:15 AM10/14/13
to taiwa...@googlegroups.com
找了R軟體的機率分配代號 , 
也用??搜尋過 , 但似乎找不到二元常態分配的代號 , 
也不知道要用哪一個工具繪圖 , 
嘗試用image但完全失敗 , 
故上來請教。

WEPA ^_^

unread,
Oct 14, 2013, 11:36:50 AM10/14/13
to taiwa...@googlegroups.com
Please try:
 
# bivariate normal distribution plot
library(MASS)
Sigma <- matrix(c(1, 0.5, 0.5, 1), 2)
bivnorm <- mvrnorm(n=1000, rep(0, 2), Sigma)
bivnorm.kde <- kde2d(bivnorm[,1], bivnorm[,2], n=50)
persp(bivnorm.kde, phi=45, theta=40, shade=0.1, main="bivariate normal distribution plot")
image(bivnorm.kde, main="contour plot for bivariate normal distribution")
contour(bivn.kde, add=TRUE)
# end

 

statisti...@gmail.com於 2013年10月14日星期一UTC+8下午9時06分15秒寫道:

WEPA ^_^

unread,
Oct 14, 2013, 11:57:31 PM10/14/13
to taiwa...@googlegroups.com
bivn.kde 修正為bivnorm.kde正確指令:
 
contour(bivnorm.kde, add=TRUE)

WEPA ^_^於 2013年10月14日星期一UTC+8下午11時36分50秒寫道:
Reply all
Reply to author
Forward
0 new messages