aws代做 | assignment – Assignment 1

Assignment 1

aws代做 | assignment – 这个题目属于一个aws的代写任务, 涵盖了aws等方面

ass代做 assignment代写 代写assignment

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
E
(
X^2
)
,
whereXis a standard normal distribution. One can directly show thatE
(
X^2
)
is 1. Set the
random seed to 120. Generate 20 , 40 ,..., 200 dr aws 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( andYare independent standard normal random variables. We define two new random variables
X,  Y )as
( 
X,Y 
)
=
(
1
4
X+
3
4
Y,
3
4
X+
1
4
Y
)
.
We know these two random variables are normal. What are the marginal distributions ofX 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

x 1 ,x 2 ,x 3 ,...
y 1 ,y 2 ,y 3 ,...
and create the new series
1
4
x 1 +
3
4
y 1 ,...
3
4
x 1 +
1
4
y 1 ,...
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) Lets consider simulating the conditional probabilities. Suppose we would like to calculate the
probability of
Pr
(
X 1 |Y 2
)
.
The conditional probability is given by
Pr
(
X 1 ,Y 2
)
Pr
(
Y 2
)
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
E
(
X|X 1
)
.
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
E
(
X|X 1 ,Y 2
)
.
  1. 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 meanand 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 .96from. 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
tandt+ 1be? What is the sample correlation?
(e) Let the price ontbey t. Create new data
r t =
y t +1y t
y t
.
You will have one fewer observation thany t. What is the sample correlation betweenr t +1and
r t? Is the i.i.d assumption more or less likely to hold?
(f) Calculate the standard deviation ofr t and the bootstrapped standard error. Bootstrap 1000
times.
(g) Calculate the data analog of the following statistic
=
E(V^2 ),
whereV = min{ 0 ,r t }. 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 estimateand calculate
the bootstrapped standard error.
2