ECMT3150 R语言分析

ECMT3150: Assignment 1 (Semester 1, 2022)

Due: 5pm, 18 March 2022 (Friday)

  1. [Total: 20 marks] Bob is a grown-up now. With the pocket money from his dad Simon,
    Bob went to the casino to try his luck. Being a ?rst-time gambler, he decided to start by
    betting big-and-small.
    For the sake of this question, we assume the game is fair in the sense that all rounds are
    independent and the probabilities of winning and losing in a round are both equal to 0.5.
    More precisely, we de?ne the indicator yn as follows:
    yn =
    (
  2. if Bob wins in the nth round,
  3. if Bob loses in the nth round.
    The assumptions on the game given above imply that (yn)n1 is a sequence of iid random
    variables with P (yn = 1) = P (yn = 1) = 0:5.
    Let Vn (in dollars) denote Bob?s stake in the nth round. The stake is determined by Bob
    before the nth round starts. If Bob bets Vn in the nth round and wins, he will gain Vn in
    that round (hence receiving a total of 2Vn); otherwise he will lose Vn (hence receiving a total
    of 0 dollars). Note that Vn may depend on the outcomes of the ?rst n 1 rounds. A given
    sequence (Vn)n1 de?nes a betting strategy.
    Let Xn denote Bob?s total gain after the nth round. We set X0 = 0. It is clear that Xn is
    given by
    Xn =
    nX
    i=1
    Viyi.
    (a) [4 marks] De?ne Xn := Xn Xn1 for n 1. Show that the sequence (Xn)n1 is a
    martingale di¤erence sequence.
    (b) [3 marks] Show that E(Xn) = 0 for all n. In words, Bob will break even on average.
    Suppose Bob adopts the ?grandpa?s strategy?by betting $1 in each round regardless of what
    happened, i.e., Vn 1 for all n.
    (c) [3 marks] What is the distribution of Bob?s total gain after 5 rounds?
    (d) [2 marks] What is the probability that Bob will su¤er a loss after 5 rounds?
    1
    Bob claims that he can beat the house by adopting the following betting strategy (let?s call
    it ?the banker?s strategy?): He bets $1 in the ?rst round. If Bob wins in the previous round,
    he stops playing; otherwise he doubles the bet in the following round. Bob will keep playing
    until he wins for the ?rst time or he uses up all the money that Simon gave him, whichever
    happens ?rst. More precisely, we can represent the banker?s strategy as follows: V1 = 1, and
    for n > 1,
    Vn =
    (
    2n1 if y1 = 1, y2 = 1, . . . , yn1 = 1,
  4. otherwise.
    (e) [2 marks] What is Bob?s total loss after he loses all the ?rst 10 rounds, supposing that
    Bob has enough pocket money to survive beyond 10 rounds?
    (f) [2 marks] What is Bob?s total gain after he wins for the ?rst time?
    (g) [4 marks] Bob claims that by adopting the banker?s strategy he will for sure bring back
    home with more money than what Simon gave him if he plays long enough. Assuming
    that the game is fair, do you agree with Bob? Why or why not?
  5. [Total: 16 marks] Let It be the indicator for the stock price movement in period t (-1 =
    price decrease; 0 = no change in price; 1 = price increase). Suppose the price movement is a
    Markov process in the sense that the price movement in the current period depends only on
    the price movement in the previous period. The joint probability distribution of It1 and It
    is given in the table below, where p00, p01, p10, and p11 are constants. The row and column
    sums are displayed in the last column and in the last row, respectively.
    It = 1 It = 0 It = 1
    It1 = 1 0.04 0.14 0.02 0.2
    It1 = 0 0.14 p00 p01 0.7
    It1 = 1 0.02 p10 p11 0.1
    0.2 0.7 0.1
    (a) [2 marks] Find E(It) and V ar(It).
    (b) [2 marks] Is the process (It)t1 stationary? Explain.
    (c) [3 marks] Find the conditional distribution of It given that the price increases at time
    t 1. Express your answer in terms of p11.
    (d) [3 marks] Find the conditional variance of It given that the price increases at time t 1.
    Express your answer in terms of p11.
    (e) [2 marks] Suppose the stock price movement are independent. Find the value of p01.
    (f) [4 marks] Suppose the stock price movement are positively correlated. Find the range
    of values of p00.
    2
  6. [Total: 20 marks]
    Note: Please append your R codes (as a separate .R ?le) while you submit the assignment.
    Carol, an amateur economist, proposes the following time series model for unemployment
    rate:
    where "t iid N(0; 0:022) (normal distribution with mean 0 and variance 0:022). The time
    period is measured in number of quarters.
    (a) [3 marks] Show that the time series fytg generated by model (1) is stationary.
    (b) [3 marks] There is a stochastic cycle in the time series generated by model (1). Find its
    periodity in number of quarters.
    (c) [4 marks] Compute the ACF for the ?rst 3 lags, i.e., (1), (2) and (3).
    (d) [2 marks] Write an R program to simulate a sample path of fytg over 30 years. Set the
    initial values y0 and y1 to be y0 = 0:1 and y1 = 0:12. While simulating the random
    numbers for "t, set the random seed to be your last 5 digits of your SID (this is to ensure
    that your answer will be di¤erent from that of other students).
    (e) [2 marks] Plot the sample ACF and record its value for the ?rst 3 lags (the values can be
    retrieved from the acf command output stored as a list). Why are they di¤erent from
    your answers in part (c)?
    (f) [3 marks] Using the simulated sample path in part (d), estimate an AR(2) model using
    the R command arima. Write down the estimated model with the parameter estimates
    and their standard error. Also record the estimated variance of the innovations.
    [Important note: the ?intercept?estimate in the arima output is in fact the unconditional
    mean; see Rob Hyndman?s page for details: https://robjhyndman.com/hynds...
    arimaconstants/.]
    (g) [3 marks] Using the simulated sample path in part (d) and the R package forecast,
    plot the point forecast and the con?dence interval for each period over the next 5 years.
    Describe the short-run and long-run behaviour of the point forecast and the con?dence
    interval.

你可能感兴趣的:(机器学习)