关键词 > STSCI/ORIE5640

STSCI/ORIE 5640, Spring 2023 Computer Laboratory 1: Returns

发布时间:2023-02-09

Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit

STSCI/ORIE 5640, Spring 2023

Computer Laboratory 1:  Returns

This assigned work should be handed in as Computer Laboratory #1 via Canvas by Jan 31, 2023

Include your R code with your homework.  This will allow the grader to help you nd errors if you make any and to give partial credit. The point value of each question is in square brackets, for example [15].

Do not print an excessive number of digits when printing R output; use the options() or round() function to control the number of digits.

Add a title to your plots and add a legend when several curves appear on the same plot. Use appropriate labels for the axes and make sure that the font sizes of gures are not too small. They should be roughly the same size as in the text.

This assignment uses log returns on Starbucks from Jun 1, 2006 to Dec 13, 2019. Run the code below to load the variable rSBUX containing the log returns in the R dataset lab1 .RData.  rSBUX is a time series (R classes  xts” and  zoo”) and so has embedded time series information such as dates. The variable r created at line 7 has the same data as rSBUX but with times series information removed by the function as .numeric(). You will see that rSBUX and r are plotted somewhat differently, although they have the same numerical values.

1    load("lab1 .RData")

2    head(rSBUX)

3    tail(rSBUX)

4    par(mfrow=c(1,2))

5    plot(rSBUX)

6    class(rSBUX)

7    r  =  as .numeric(rSBUX)

8    class(r)

9    plot(r,type="l")

1.  Compute the net returns, call them R, and plot R on the y-axis versus r on the x- axis. Put a 45-degree reference line on the plot with abline(a=0,b=1). Compute the minimum value of r > _ . You will see that R is never smaller than r, and, in fact, you will prove that r ≥ _ on a homework assignment. You need not include the plots with your assignment, only your R output.     [15]

2.  Suppose that the daily log returns of a stock are iid normally-distributed with u = 0R00058 and a = 0R019.  Use simulations to answer the following questions. Use at least 100,000 simulations.

(a) What is the expected value of the maximum price over 20 days starting at $91

on day 1? Give a point estimate and a 99% confidence interval.     [15]

(b)  Starting again at $91 on day 1, what is the probability that the minimum

daily price over 20 days is attained earlier than the maximum price over that period? Give a point estimate and a 99% confidence interval.     [20]

(c) A contract pays $10 if the maximum daily price over 20 days exceeds $98 and the daily price over the 20 days never falls below $89 more than once. Otherwise, it pays nothing. What is the expect value of this contact starting at $91 on day 1? Give a point estimate and a 99% confidence interval.     [25]