Showing posts with label DATA SCIENCE FINANCIAL CODE. Show all posts
Showing posts with label DATA SCIENCE FINANCIAL CODE. Show all posts

DATA SCIENCE FINANCIAL CODE

 DATA SCIENCE  FINANCIAL CODE
Add code

> set.seed(4711)
> Index <- 1:260
> Returns <- rnorm(260)
> plot(x = Index, y = Returns)
> plot(x = Index, y = Returns, main = "Artificial Returns")
> par(mfrow = c(2, 1))
> Price = cumsum(Returns)
> plot(Index, Price, type = "l", main = "Line Plot")
> plot(Index, Returns, type = "h", main = "Histogram-like Vertical Lines")
> hist(Returns, probability = TRUE)
> curve(dnorm(x), min(Returns), max(Returns), add = TRUE, lwd = 2)
> plot(xf)
Error in plot(xf) : object 'xf' not found
> plot(x.df)
Error in plot(x.df) : object 'x.df' not found
> factorData <- factor(sample(c(rep("AMEX", times = 40), rep("NASDAQ",
+ times = 180), rep("NYSE", times = 90))))
> tsData = ts(matrix(rnorm(64), 64, 1), start = c(2001, 1), frequency = 12)
> plot(factorData, col = "steelblue")
> > plot(factorData, rnorm(length(factorData)), col = "orange")
Error: unexpected '>' in ">"
>  plot(factorData, rnorm(length(factorData)), col = "orange")
> plot(dnorm, min(tsData[, 1]), max(tsData[, 1]), xlab = "Returns",
+      yla = "Density", main = "Density")
> grid()
> plot(tsData, xlab = "Index", ylab = "Returns", main = "Return Series")
> abline(h = 0)
> abline(h = 2)
> abline(h=-2)