聯系方式

您當前位置:首頁 >> Python編程Python編程

日期:2019-08-13 10:43

Assignment 1

The assignment consists of both written and programming components

1. Use simulations to compute probabilities and expectation.

(a) The goal of the first exercise is to compute

where X is a standard normal distribution. One can directly show that E

is 1. Set the

random seed to 120. Generate 20, 40, . . . , 200 draws from a standard normal distribution. For

each data set, compute the sample mean of the squares of the data points. Plot the result for

each sample size and check whether the average approaches 1 as the size of the data set increases.

(b) X and Y are independent standard normal random variables. We define two new random variables

We know these two random variables are normal. What are the marginal distributions of X and Y (You need to calculate their means and variances using formulas)

(c) The covariance of the two random variables is 3

8

. We now calculate this covariance using Python:

simulate two series of numbers from standard normal distributions

x1, x2, x3, . . .

y1, y2, y3, . . .

and create the new series

Calculate the sample covariance for your simulations. Do this for data sets of size 200, 400, . . .,

2000, and plot the sample covariances and see whether they approach 3

8.

(d) Let’s consider simulating the conditional probabilities. Suppose we would like to calculate the

probability of

The conditional probability is given by

some fraction of the simulations

some other fraction of the simulations.

Use the same data sets as (c), calculate the fractions for data sets of size 200, 400, . . ., 2000,

and plot the ratios. Note that in this case, we do not have a closed solution and have to rely on

simulations.

1

(e) We can also calculate conditional expectations. Suppose we would like to use simulation to

calculate.

You still will calculate a sample mean, but on a specific subsample. Again, do this for all the data

sets in (c) and see which value the results approach.

(f) Repeat (e) for

2. Bootstrap methods to calculate statistics. Re-set the random seed to 120

(a) Download the 2019 AMD stock prices at daily frequency from Yahoo finance. Read in the data

with Python. (The data should start on the first day available in 2019 and end some time in

August. The exact end date does not matter.)

(b) Focus on the variable called “adjusted closing price”. Our analysis will be based on this variable

and not other prices. Calculate the sample mean μ? and sample standard deviation σ?.

(c) If the data are from an i.i.d and normal sample, then about 68% of the data should be within one

σ? away from μ?, and 95% of the data should be within 1.96?σ from μ?. Is this the case? Calculate

the percentages of data covered by the two intervals.

(d) If the data are from an i.i.d and normal sample, what should the correlation of the prices on day

t and t + 1 be? What is the sample correlation?

(e) Let the price on t be yt. Create new data

You will have one fewer observation than yt. What is the sample correlation between rt+1 and

rt? Is the i.i.d assumption more or less likely to hold?

(f) Calculate the standard deviation of rt and the bootstrapped standard error. Bootstrap 1000

times.

(g) Calculate the data analog of the following statistic

where V = min {0, rt}. Comparing σ

2 with the variance tells you the proportion of variations

where prices move downward.

(h) Use the bootstrap samples from (f) and perform bias reduction on the estimate σ?? and calculate

the bootstrapped standard error.

2


版權所有:編程輔導網 2018 All Rights Reserved 聯系方式:QQ:99515681 電子信箱:[email protected]
免責聲明:本站部分內容從網絡整理而來,只供參考!如有版權問題可聯系本站刪除。

黑龙江体彩22选5