| > | restart: read `C:\\Tanis-Hogg\\Maple Examples\\stat.m`: |
Elliot Tanis
April 20, 2006
Exercise 5.3-6 (Exercise_5_3-6.mws)
Exercise 5.3-6 and some additional links for the Cauchy distribution.
| > | f := CauchyPDF(x); |

| > | for k from 1 to 9 do w := Pi*rng() - Pi/2: XX[k] := evalf(tan(w)): od: X := [seq(XX[k], k = 1 .. 9)]; |
![]()
![]()
| > | Mean(X); |
![]()
| > | X := sort(X); |
![]()
![]()
| > | Median(X); |
![]()
(c) Here is a simulation of 1000 observations of a Cauchy random variable.
| > | numgt1 := 0: # number greater than 1 numgt5 := 0: # number greater than 5 numgt10 := 0: # number greater than 10 for k from 1 to 1000 do w := Pi*rng() - Pi/2: X := evalf(tan(w)): if X > 1 then numgt1 := numgt1 + 1 fi: if X > 5 then numgt5 := numgt5 + 1 fi: if X > 10 then numgt10 := numgt10 + 1 fi: od: |
| > | numgt1; evalf(numgt1/1000); evalf(int(f, x = 1 .. infinity)); |
![]()
![]()
![]()
| > | numgt5; evalf(numgt5/1000); evalf(int(f, x = 5 .. infinity)); |
![]()
![]()
![]()
| > | numgt10; evalf(numgt10/1000); evalf(int(f, x = 10 .. infinity)); |
![]()
![]()
![]()
| > |
If you want to see additional simulations for the Cauchy distribution, click on the following link.