关于算法:STAT-2011-概率理论

39次阅读

共计 2313 个字符,预计需要花费 6 分钟才能阅读完成。

STAT 2011 Probability and Estimation Theory – Semester 1, 2023
Computer Assignment – Due by 23:59pm 21 May
Instructions: Complete this computer assignment, prepare a report including your code, and
any output, plots or comments required by the questions and submit it on the Assignment item
on Canvas. The file upload format is limited to pdf and html. We highly encourage you to knit
your report using R Markdown, but the report can be created any way that is convenient as
long as it includes all the required content.

  1. In a gambling game, a player wins the game if they roll 10 fair, six-sided dice, and get a
    sum of at least 40.
    (a) Approximate the probability of winning by simulating the game 104 times. Use
    set.seed(200) for this question. Output your approximate probability, but do not
    print your simulated rolls.
    (b) Compute the Central Limit Theorem approximation P (Y ≥ 40), where Y is the sum
    of 10 dice, and compare it to the Monte Carlo approximation obtained above. You
    can use the fact that E(Y) = 35, Var(Y) = 175/6.
  2. The frequency table below summarises 320 counts,
    Value 0 1 2 3 4
    Freq 130 133 49 7 1
    modelled as values taken by i.i.d. random variables with common Bin(4, p) distribution,
    i.e.
    for some unknown p.
    (a) Recall E(X) = np, estimate p using the method of moments.
    (b) Using (a), find expected frequencies (E) for each of the classes“0”,“1”,“2”,“3”
    and“4”. Round to the nearest integer.
    (c) Compute standardised residuals (SR) given by SR = O?E√
    E
    for each of the classes
    “0”,“1”,“2”,“3”and“4’, where O represents the observed frequencies. If |SR| < 2,
    then the fitted binomial model is said to be a good model for the data. Comment
    on the goodness of fit.
  3. Use set.seed(100) to answer this question.
    (a) Generate a random sample of size 25 from a normal distribution with mean μ = 3
    and standard deviation σ = 1.5. Assume σ is known and we want to estimate μ.
    Using the sample generated, find a 95% confidence interval (CI) for μ.
    (b) Repeat the process in (a) 20 times. Using your 20 samples, calculate 20 CIs for μ.
    How many of these 20 intervals contain the true mean μ = 3? Output this number
    from your code, but no need to print the 20 CIs themselves.
    1
  4. Use set.seed(100) to answer this question.
    (a) Generate a random sample of size 30 from the exponential distribution with param-
    eter λ = 2 and find the mean of your sample. Repeat this process 1000 times and
    draw a histogram of these 1000 means (use prob=T in hist). (Do not print the 1000
    means.)
    (b) Next we check whether the Central Limit Theorem gives a good approximation for
    the distribution of the means. Overlay the histogram with a normal density curve
    with appropriate mean and variance. (You will need to use the mean and variance
    of exponential distributions from lectures. No need to derive). Comment on the fit.
正文完
 0