[R] mnormt package for bivariate normal distribution

Vahid Borji v@h|d@borj|65 @end|ng |rom gm@||@com
Wed Jun 17 17:35:24 CEST 2020


Hi, my R friends,
I am going to plot the surface of a bivariate normal distribution and its
contours. I have written the below codes:

library(MASS)

set.seed(69)
n <- 5000
x <- rnorm(n, 0, 15)
y <- 0.5 * x  + rnorm(n, 0, 10)
z <- kde2d(x, y, n = 50)

persp(z, theta = 55, phi = 35,
      shade = 0.75, col = "gold", expand = 0.5, r = 2,
      ltheta = 25, ticktype = "detailed")

contour(z)

It seems that I could use mnormt package for bivariate normal distribution.
How can I use suitable functions of mnormt package in my above codes?
Indeed I want to change my above codes somewhat and use the mnormt package.

Thank you in advance

	[[alternative HTML version deleted]]



More information about the R-help mailing list