Created
November 26, 2014 18:16
-
-
Save abikoushi/fc65567d00c6cd1e1bb7 to your computer and use it in GitHub Desktop.
probability density function of bivariate normal distribution
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dnorm2 <- function(x, y, r=0.7){ | |
det <- 1- r^2 | |
return( | |
1/(2 * pi * sqrt(det)) * exp(-(x^2 -2 * r * y + y^2)/(2*det) ) | |
) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Argument
x: x-coordinate
y: y-coordinate
r: correlation coefficient
Example