Question

Determine a method to generate random observations for the Laplace pdf. If access is available, write an R function which returns a random sample of observation from a Laplace distribution.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

> ## install "rmutil" R package
>
> library(rmutil)
>
> data=rlaplace(n=50, m=0, s=1)
> data
[1] -1.30236491 1.44954964 0.14647383 -0.19840311 -1.58270860 3.01498590
[7] -0.03368618 -0.01649112 1.63712209 1.87807825 -0.19292235 -1.25757044
[13] 1.65227739 1.63162978 -0.20379632 -1.36775629 1.97616613 0.54970665
[19] -1.99288684 0.88957333 0.37725789 -0.42262610 -1.95727814 0.98419761
[25] 3.13923809 1.83653814 -0.20401601 -0.13804444 -1.69516214 0.09733094
[31] -2.30680813 0.19693882 -1.13176007 0.49130645 -0.11651602 -1.49790769
[37] -0.50380373 0.57563257 0.29256264 -0.85044427 -0.27626054 2.14790177
[43] 0.20260942 -0.06807347 0.59691364 -2.03365779 -0.53093729 0.36291089
[49] -0.35579759 -0.87894641
>
> # Arguments
>
> # n number of values to generate
> # m vector of location parameters.
> # s   vector of dispersion parameters.

Add a comment
Know the answer?
Add Answer to:
Determine a method to generate random observations for the Laplace pdf. If access is available, write...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Suppose that we wish to generate observations from the discrete distribution 3 a) Suppose that we...

    Suppose that we wish to generate observations from the discrete distribution 3 a) Suppose that we wish to generate observations from the discrete distribution with probability mass function 2)+1 20 x=1,2, 3, 4, 5 Clearly describe the algorithm to do this and give the random numbers corresponding to the following uniform(0,1) sample. 0.5197 0.1790 0.9994 0.6873 0.7294 0.5791 0.0361 0.2581 0.0026 0.8213 NB: Do not use R for this part of the question. two numbers rolled. Write an R function...

  • How to do the following in R: Write a function to generate a random sample of size n from the Gam...

    How to do the following in R: Write a function to generate a random sample of size n from the Gamma(α,1) distribution by the acceptance-rejection method. Generate a random sample of size 1000 from the Gamma(3,1) distribution. (Hint: you may use g(x) ∼ Exp(λ = 1/α) as your proposal distribution, where λ is the rate parameter. Figure out the appropriate constant c).

  • 3 a) Suppose that we wish to generate observations from the discrete distribution with probability mass...

    3 a) Suppose that we wish to generate observations from the discrete distribution with probability mass function 2)+1 20 x=1,2, 3, 4, 5 Clearly describe the algorithm to do this and give the random numbers corresponding to the following uniform(0,1) sample. 0.5197 0.1790 0.9994 0.6873 0.7294 0.5791 0.0361 0.2581 0.0026 0.8213 NB: Do not use R for this part of the question. two numbers rolled. Write an R function which will generate n random rolls of a pair b) Consider...

  • Question Let X be a continuous random variable with the following probability density function (pdf) 0.5e...

    Question Let X be a continuous random variable with the following probability density function (pdf) 0.5e fx (x) = { 0.5e-1 x < 0. <>0.. (a) Show that fx (x) is a valid pdf. (b) Find the cumulative distribution function Fx (.x). (e) Find F='(X). (d) Write an algorithm to generate a sample of size 1000 from the distribution of X using the inverse-transform method. Be as precise as possible.

  • Let X1 Xn be a random sample from a distribution with the pdf f(x(9) = θ(1...

    Let X1 Xn be a random sample from a distribution with the pdf f(x(9) = θ(1 +0)-r(0-1) (1-2), 0 < x < 1, θ > 0. the estimator T-4 is a method of moments estimator for θ. It can be shown that the asymptotic distribution of T is Normal with ETT θ and Var(T) 0042)2 Apply the integral transform method (provide an equation that should be solved to obtain random observations from the distribution) to generate a sam ple of...

  • 4 a) Prove that the Box-Muller method described in class generates independent standard ll generate n...

    4 a) Prove that the Box-Muller method described in class generates independent standard ll generate n to write a function which wi σ-) random variables b) Suppose that X is an exponential random variable with rate parameter λ and that Y is the integer part of X. Show that Y has a geometric distribution and use this result to give an algorithm to generate a random sample of size n from the geometric distribution with specified success probability p implementing...

  • a) The pdf of a random variable X is (1-μ e 26 The generating function of...

    a) The pdf of a random variable X is (1-μ e 26 The generating function of X is t2 -2 Use what you see to write down the Fourier transform of pdf[x] b) What is the relation between The Fourier transform of pdf[x] and the characteristic function of X? c) If the pdfs of two random variables have the same Fourier transform, then must they have the same cumulative distribution function? L.14 The pdf of a random variable X is...

  • Let X1...Xn be a random sample from a continuous distribution with Lomax PDF with gamma=2 a) determine the maximum likelihood estimator of alpha b) determine the estimator of alpha using the method of...

    Let X1...Xn be a random sample from a continuous distribution with Lomax PDF with gamma=2 a) determine the maximum likelihood estimator of alpha b) determine the estimator of alpha using the method of moments

  • Prove that Box-Muller method described in class generates independent standard normal random variables. 4 a) Prove...

    Prove that Box-Muller method described in class generates independent standard normal random variables. 4 a) Prove that the Box-Muller method described in class generates independent standard ll generate n to write a function which wi σ-) random variables b) Suppose that X is an exponential random variable with rate parameter λ and that Y is the integer part of X. Show that Y has a geometric distribution and use this result to give an algorithm to generate a random sample...

  • A continuous random variable Z is said to have a Laplace(H, b) distribution if its PDF...

    A continuous random variable Z is said to have a Laplace(H, b) distribution if its PDF is given by: where μ R and b > 0. a) Ifx-Laplace( 0, b-1), find E(X] and Var[X]. b) If X ~ Laplace(p = 0, b 1) and Y bX + μ, show that Y is a Laplace random variable. c) Let Z ~ Laplace(u, b), where μ E R and b > 0. Find E[2] and Var [2]

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT