Showing posts with label plot-R. Show all posts
Showing posts with label plot-R. Show all posts

Wednesday, December 5, 2018

Plot-R

PLOT- R
lines(density(x), col="blue")
> xnew <- seq(min(x), max(x), length=100)
>
> lines(xnew, dnorm(xnew, mean(x), sd(x)), col="red")
>
> x <- seq(-3,3, length=100)
> plot(x, dnorm(x), type="l", col="red")
> lines(x,dt(x, df=1), col="cyan")
> lines(x,dt(x, df=2), col="blue")
> lines(x,dt(x, df=4), col="cyan")
> lines(x,dt(x, df=8), col="blue")
>
> lines(x,dt(x, df=16), col="blue")

> par(oma = c(0, 0, 3, 0))
>
> x <- seq(0, 10, 0.1)
> y <- sin(x)
> plot(x, y)
> plot (x,y^3)
> plot(x^3,Y^3)

Black-Scholes formula-R

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