Displaying 1 result from an estimated 1 matches for "xoy".
Did you mean:
xor
2010 Feb 20
1
Add lines (contours) to lattice wireframe plot
Hi,
I draw a surface corresponding to bivariate density of independent
variables (rho=0) using persp(). Then I add a contour line (i.e.,
circle in my case) at a particular density. Below is a minimal example
of what I have so far.
# Bivariate density
dnorm2d <- function(x, y, rho = 0) {
xoy = (x^2 - 2 * rho * x * y + y^2)/(2 * (1 - rho^2))
density = exp(-xoy)/(2 * pi * sqrt(1 - rho^2))
density
}
# Variables
x <- seq(from = -3, to = 3, length = 40)
y <- seq(from = -3, to = 3, length = 40)
z <- outer(X = x, Y = y, FUN = dnorm2d)
# Perspective plot
persp(x = x, y = y, z = z)...