Question: Run the following R code. The set.seed ( ) command insures that everyone using this code will have the same random numbers and will obtain

Run the following R code. The set.seed() command insures that everyone using this code will have the same random numbers and will obtain the same price series. There are 253 trading days per year, so you are simulating 1 year of daily returns nine times. The price starts at 120.
The code par(mfrow=c(3,3)) on line 3 opens a graphics window with three rows and three columns and rnorm() on line 6 generates normally dis- tributed random numbers.
1 set.seed(2012)
2 n=253
3 par(mfrow=c(3,3))
4 for (i in (1:9))
5{
6 logr = rnorm(n,0.05/253,0.2/ sqrt(253))
7 price = c(120,120* exp(cumsum(logr)))
8 plot(price, type ="b")
9}
Problem 9 In this simulation, what are the mean and standard deviation of the log-returns for 1 year?

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!