码迷,mamicode.com
首页 > 其他好文 > 详细

ANLY-511 Homework 4 Problems

时间:2019-10-01 20:17:23      阅读:75      评论:0      收藏:0      [点我收藏+]

标签:lam   make   ever   inpu   邮箱   get   case when   several   ted   


ANLY-511 Homework 4 Problems
Submit problems 35,37,38,40,41,42 and 46. Explain your work, give concise
reasoning, and . Attach R code with comments if applicable. Using Markdown
is the best way to do this. Do not print out any data or any detailed results of
simulations.
35. (2 points) Consider a symmetric random walk: the states are integers
x ∈ Z and the transition probabilities are
P(Xi+1 = x + 1|Xi = x) = P(Xi+1 = x − 1|Xi = x) = 1
2
for all i and all x. Assume that X0 = 0. Let T be the random time when |XT | = 15
for the first time. Use a simulation to generate a few hundred values of T and then
make a box plot of T. Your answer should consist of commented simulation code
and either the box plot or a description (max, min, quartiles, median). Also state
the observed probability of not hitting x = ±15 at all.
36. (2 points) In American roulette it is possible to bet on a block of twelve
numbers, consisting e.g. of the numbers from 1 to 12 or from 13 to 24. The casino
will pay you 2:1, i.e. three times your bet if one of these numbers comes up, and
you lose your bet otherwise. Propose a modification of the St. Petersburg system
for somebody who only uses this bet, and explain it. The first bet and the bet after
each win should be $1. If you win after several losses, you should win back all your
losses plus some extra money. Assume that you can make bets in dollars and cents.
37. (2 points) Bob’s preferred bet in American roulette consists in betting
$1 on black numbers and simultaneously $2 on even numbers (see the roulette
board in the course slides). Find all possible outcomes of a single game and their
probabilities, that is, find the probability distribution of the outcome of a single
bet. Then compute its expected value.
38. (2 points) Consider a room that is paved with n × n square tiles which
are labeled from 1 to n
2
. The tiles are labeled from 1 to n
2
in some order. A frog
performs a random walk by hopping from one tile to a randomly chosen adjacent
tile in each time step. All adjacent tiles are chosen with the same probability. The
frog can never hop into a wall of the room.
True or not true: the transition matrix for this random walk is symmetric, that is,
it satisfies P(Xi+1 = k|Xi = j) = P(Xi+1 = j|Xi = k) for all i and all possible
states 1 ≤ j, k ≤ n
2
. Explain your answer.
39. (2 points) Suppose X = (X1, X2, X3) has a multinomial distribution with
size n = 10 and probabilities p1 = .2, p2 = .5, p3 = .3. Show that P(X1 = 2, X2 =
4, X3 = 4) = 0.0637875, using the formula involving n! in the slides. Do not use
dmultinom.
40. (2 points) Suppose X = (X1, X2, X3) has a multinomial distribution with
size n = 10 and probabilities p1 = .2, p2 = .5, p3 = .3. Use a simulation with
rmultinom to show that P(X1 = 2, X2 = 4, X3 = 4) ≈ 0.0638. Confirm your
results using dmultinom.
41. (2 points) Suppose X = (X1, X2, X3) has a multinomial distribution with
size n = 10 and probabilities p1 = .2, p2 = .5, p3 = .3. Use a simulation with sample
1
2
(not rmultinom) to show that P(X1 = 2, X2 = 4, X3 = 4) ≈ 0.0638. Confirm your
results using dmultinom.
42. (2 points) Updated on 10/5 Consider the following game: you get to
roll an n-sided fair die once. Let k be the outcome of that die roll, then you get to
throw k darts at a target. The probability of hitting the target is p. Dart throws
are independent of one another.
Let X be the result of the roll of the die, and let Y be the number of hits when you
throw the darts. Set up the joint probability mass function (pmf) for X and Y .
43. (5 points) Consider a symmetric random work as in problem 35. Given
integers a < 0 < b, we are interested in the event that the random walk reaches
x = a before it reaches x = b. Formerly, this means
min{i : Xi = a} < min{j : Xj = b} .
a) Write a function myHits(N,a,b) that simulates N steps of this random walk.
The function then should return T if the simulation reaches x = a before it reaches
x = b (including the case when it reaches x = a but not x = b). It should return F
if the simulated walk reaches x = b before it reaches x = a. It should return NA if
the simulated walk does not reach x = a or x = b during these N steps. Explain
the code.
b) Use a function and sufficiently many simulations to estimate the probability that
a symmetric random walk reaches a = −8 before it reaches b = 6.
44. (5 points) Suppose X = (X1, X2, . . . , X8) has a multinomial distribution
with size n = 10 and probabilities p1 = p2 = p3 = p4 = .2, p5 = p6 = p7 = p8 =
0.05. Use suitable simulations to estimate the following probabilities:
a) P(X1 + X2 + X3 ≤ 5)
b) P(X1 + X2 + X3 ≤ 5 and X6 + X7 + X8 ≥ 3)
c) P(X1 + X2 + X3 ≤ 5 | X1 + X2 + X3 + X4 is even)
45. (5 points) Suppose (X1, X2, X3) is a vector of random variables with the
joint probability density function
f(x1, x2, x3) = (
1 if 0 ≤ x1, x2, x3 ≤ 1
0 otherwise
This is a uniform distribution on the set {(x1, x2, x3) : 0 ≤ x1, x2, x3 ≤ 1}. You
can draw a single sample with the command runif(3).
a) Explain geometrically why P(X2
1 + X2
2 + X2
3 ≤ 1) = π
6
. Think about the volume
of a sphere.
b) Confirm this with a simulation with at least 105
samples.
46. (5 points) Consider the random walk performed by the caveman in the
class slides.
a) Using the transition matrix that was derived in class, compute P(X3 = 3|X0 =
1). Then do the same computation directly. Do not print out the entire transition
matrix.
b) Find the first time T such that the chance of the caveman’s survival for more
than T steps is less than 25% no matter where he starts, using R .
3
47. (5 points) Let N be a random variable with a Poisson distribution with
parameter λ > 0. Given that N = n, let X be a binomial B(n, p) distribution
where 0 < p < 1.
a) Set up the joint probability mass function for N and X, in terms of the parameters
λ and p.
b) Write an R function with input λ, p, k that simulates k values of X.
c) Pick some values of λ and p and simulate sufficiently many instances in each
case to obtain an estimate of E(X). Use sapply or replicate, do not use for
loops. Then guess a formula for E(X) and explain why it makes sense to you. To
document this, only state your choice of λ and p, the number of simulations, and
your estimate for the expected value in each case.

因为专业,所以值得信赖。如有需要,请加QQ:99515681 或邮箱:99515681@qq.com

微信:codehelp

ANLY-511 Homework 4 Problems

标签:lam   make   ever   inpu   邮箱   get   case when   several   ted   

原文地址:https://www.cnblogs.com/BNJAVA/p/11615765.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!