老板布置任务,刚开始学习R,不太熟习,请教大家
先谢谢啦!!!!
现在,我用命令
library(MASS)
sigma<-matrix(c(1,0.5,0.5,1),2,2);
X<-mvrnorm(100,c(0,0),sigma);
产生了100个二维正态随机数,怎么产生它的三维图表示?
请大侠指点!!
[em12][em12] |
楼主: willing0909
|
3641
9
[求助]如何模拟三维正态图? |
|
已卖:504份资源 本科生 38%
-
|
回帖推荐that expression "exp(-(x^2-2*sigma*x*y+y^2)/2/(1-sigma^2))/2/pi/sqrt(1-sigma^2)" is the expression for bivariate-normal distribution density function. if you have no prior knowledge about the distribution of your data. there is not too much you can do. maybe use some non-parametric methods to estimate their potential distributions.
You need to calculate the density for each element of an array whose
rows correspond to x values, and columns to y values. And then use persp to draw the 3d plot. Hope the following helps. library(MASS)sigma<-matrix(c(1,0.5,0.5,1),2,2);X<-mvrnorm(100,c(0,0),sigma);x<-seq(-3,3,by=.01)y<-xphi<-function(x,y) {sigma=cor(X)[1,2]exp(-(x^2-2*sigma*x*y+y^2)/2/(1-sigma^2))/2/pi/sqrt(1-sigma^2)} ...
本帖被以下文库推荐
| ||
|
|
| ||
| |||
| ||
| ||
| ||
加好友,备注cda京ICP备16021002号-2 京B2-20170662号
京公网安备 11010802022788号
论坛法律顾问:王进律师
知识产权保护声明
免责及隐私声明


