Question

In: Statistics and Probability

The Cauchy(µ,σ) distribution has the pdf f(x)= 1 σ π 1 1+((x−µ)/σ)2,x ∈R. a. Write an...

The Cauchy(µ,σ) distribution has the pdf f(x)= 1 σ π 1 1+((x−µ)/σ)2,x ∈R.

a. Write an R function that generates a random sample of size n from a Cauchy(µ,σ)distribution. Do not use the rcauchy function. Your function should use the inverse transformation from to generate a random sample from a standard Cauchy distribution, then transform the generated sample appropriately according to the location and scale. Hint: The R function for the tangent is tan(x).

b. Use your function from part (a) to generate a random sample of size n = 10000 from a Cauchy(µ = 10,σ = 3) distribution. Give the corresponding density histogram and overly the density of a Cauchy(µ = 10,σ = 3) distribution. You can use the function dcauchy to produce the curve of the pdf.

Solutions

Expert Solution

R Code for the tanx function will be as follow:

n <- 10000
u <- runif(n)
c.samp <- sapply(u, function(u) tan(u))
hist(c.samp, breaks = 90, col = "blue",
main = "Hist of Cauchy")

The output graph after running the code will be as follow:

For the given question, PDF is not lear for first part hence i am removing that part & creating the PDF as follow:

F(x) = ((x-u)/)^2

In case of any change the F(x) function will change & rest will remain the same. u & are given in the question which can be used.

n <- 10000
x <- runif(n)
c.samp <- sapply(x, function(x) ((x-10)/3)^2)
hist(c.samp, breaks = 90, col = "blue",
     main = "Hist of Cauchy")

The output graph will be as follow:


Related Solutions

The notation X ~ N (µ, σ) means that the RV X has a normal distribution...
The notation X ~ N (µ, σ) means that the RV X has a normal distribution with mean µ and standard deviation σ. USE A RULER FOR ALL DRAWINGS. 1. What is the z-score of x, when x = 1, and X ~ N (12, 3)? 2. The average score on a math test was 70 points with a standard deviation of 12 points. Jane’s z-score was 2.2. How many points did she score? 3. In 2009, Guinness World Records...
For normal data with unknown mean µ and σ^2, we use the prior f (µ, log(σ))...
For normal data with unknown mean µ and σ^2, we use the prior f (µ, log(σ)) = 1. 23 data points: 5.36 5.29 5.58 5.65 5.57 5.53 5.62 5.29 5.44 5.34 5.79 5.1 5.27 5.39 5.42 5.47 5.63 5.34 5.46 5.3 5.75 5.68 5.85 Q. Draw sample (or theoretical) posterior joint pdf of (µ, σ^2), marginal pdf of µ, marginal pdf of σ^2, and posterior predictive pdf.
Suppose X has a Normal distribution with mean µ= 50 and standard deviation σ = 8....
Suppose X has a Normal distribution with mean µ= 50 and standard deviation σ = 8. What percent of X is between 42 and 58? What percent of X is greater than 66? What is the value of X for which 10% of the distribution is less? Determine the 35th percentile.
f(x,y)=sin(2x)sin(y) intervals for x and y: -π/2 ≤ x ≤ π/2 and -π ≤ y ≤...
f(x,y)=sin(2x)sin(y) intervals for x and y: -π/2 ≤ x ≤ π/2 and -π ≤ y ≤ π find extrema and saddle points In the solution, I mainly interested how to findcritical points in case of the system of trigonometric equations (fx=0 and fy=0). ,
Given a normal distribution with µ = 10 and σ = 2, find (a) the normal...
Given a normal distribution with µ = 10 and σ = 2, find (a) the normal curve area to the right of x = 6; (b) the normal curve area between x = 6 and x = 14; (c) the two values of x that contain the middle 75% of the normal curve area. please show all work if possible. Thank you
A) If a normal distribution has a mean µ = 40 and a standard deviation σ...
A) If a normal distribution has a mean µ = 40 and a standard deviation σ = 2, what value of x would you expect to find 2 standard deviations below the mean B) If a normal distribution has a mean µ = 70 and a variance σ2 = 16, what value of x would you expect to find 2.5 standard deviations above the mean? C)If a sample yields a mean xmean = 44 and we know that the sum...
A normal distribution has a mean of µ = 28 with σ = 5. Find the...
A normal distribution has a mean of µ = 28 with σ = 5. Find the scores associated with the following regions: a. the score needed to be in the top 41% of the distribution b. the score needed to be in the top 72% of the distribution c. the scores that mark off the middle 60% of the distribution
X, defined over the range (1, ∞) has pdf given by: f(x) = 2/x3 Calculate E(x),...
X, defined over the range (1, ∞) has pdf given by: f(x) = 2/x3 Calculate E(x), E(x2) and Var(x) Calculate E(X/5) E[(X/5)2] and Var(X/5) ​​​​​​​
Find the Fourier series for the function on the interval (-π,π) f(x) = 1 -sin(x)+3cos(2x) f(x...
Find the Fourier series for the function on the interval (-π,π) f(x) = 1 -sin(x)+3cos(2x) f(x )= cos2(x) f(x) = sin2(x)
4. Compute the minimum square error for f(x) =x/π (−π < x < π).
4. Compute the minimum square error for f(x) =x/π (−π < x < π).
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT