Showing posts with label Plot of Bivariate Standard Normal Distribution. Show all posts
Showing posts with label Plot of Bivariate Standard Normal Distribution. Show all posts

Tuesday, December 11, 2018

Plot of Bivariate Standard Normal Distribution

 Bivariate Standard Normal Distribution 

> x<-seq(-2,2,length=20)
>
> y<-x
> bvn_function(x,y){
Error: unexpected '{' in "bvn_function(x,y){"
>     + (1/2*pi)*exp(-0.5*(x^2+y^2))
 [1] 0.02877014 0.06388738 0.12983484 0.24147400 0.41101009
 [6] 0.64023229 0.91269494 1.19073932 1.42170906 1.55348745
[11] 1.55348745 1.42170906 1.19073932 0.91269494 0.64023229
[16] 0.41101009 0.24147400 0.12983484 0.06388738 0.02877014
>     + }
Error: unexpected '}' in "    + }"
> z<-x%*%t(y)
> for(i in 1:20){
+     + for(j in 1:20){z[i,j]<-bvn(x[i],y[j])}}
Error in bvn(x[i], y[j]) : could not find function "bvn"
> persp(x,y,z)

Black-Scholes formula-R

 Black-Scholes formula-R > BlackScholes <- function(TypeFlag = c("c", "p"), S, X, Time, r, b, sigma) { TypeFla...