# 代做assignment | python代写 | R语言代写 | 机器学习代写 | machine learning代做 | 数据挖掘代做 | 统计代写 | stat代写 – Pstat 160B Programming assignment 1

### Pstat 160B Programming assignment 1

Pstat 160B Programming assignment 1

``````Instructions:
``````
• You can use either R or Python. I strongly suggest you to use notebooks (either R Markdown or Jupyter).
• The code must be annotated. Show your results and make your conclusion.
• Submit these files on Gauchospace:
• pdf file, which should contain annotated code, results, graphics (if any) , conclusion.
• source file (.ipynb, .Rmd, .py or .R) in case we need to rerun your code. Therefore clearly state the seed youre using for your simulations.
``````The problems below aredue Sunday January 27th at 11:59pm.
``````
1. (Sarantsev 160 Notes, Problem 21.16 page 119) Simulate 1000 times the first 50 jumps of a Poisson process (Nt)t> 0 with intensity= 2. Calculate the empirical expectationE[N 1 N 2 ], and compare it with the true value.
2. (Dobrow, Problem 6.44 page 264) Investors purchase \$1000 dollar bonds at the random times of a Poisson process with parameter. If the interest rate isr, then the present value of an investment purchased at timetis 1000ert. Then the expected total present value of the bonds purchased by timetis 1000(1ert)r. Simulate the expected total present value of bonds if the interest rate is 4%, the Poisson parameter is= 50, andt= 10. Compare with the exact value.
3. Compound Poisson process. We modify the Poisson process to let it jump not only by 1 upward, but in a more general way. Define a sequence of i.i.d. (independent identically distributed) random variablesZ 1 ,Z 2 ,…,independent of (Nt)t 0. Then a compound Poisson process is defined as Ct=
``````Nt
``````
``````k=
``````
``````Zk.
``````
``````It starts fromC 0 = 0, then waits timeX 1 and jumps toCX 1 =Z 1. Next, it waits additional
timeX 2 (for the total timeS 1 =X 1 +X 2 ) and jumps toCS 1 =Z 1 +Z 2 , then waits timeX 3
and jumps toCS 3 =Z 1 +Z 2 +Z 3 , etc. For a Compound Poisson process the mean and the
variance are given by:
``````
``````E(Ct) =E(Nt)E(Zk)
V ar(Ct) =E(Nt)V ar(Zk) +V ar(Nt)(E(Zk))^2
``````
``````(Sarantsev 160 Notes, Problem 21.17 page 119) Simulate 1000 times the first 50 jumps of a
compound Poisson process (Ct)t 0 with incrementsZ 1 ,Z 2 ,...distributed asN(2. 5 ,4), and
intensity= 0.5. Use this to find empirical valueV ar(C 4 ), and compare this with the true
value.
``````
``````1 of 1
``````