Question

Develop a generator for a random variable whose pdf is F(x) ={ 1/3, 0<=x<=2 1/24, 2<x<=10...

Develop a generator for a random variable whose pdf is
F(x) ={ 1/3, 0<=x<=2
1/24, 2<x<=10
0, otherwise
a) Write a computer routine to generate 1000 values.
b) Plot a histogram of 1000 generated values.
c) Perform goodness-of-fit test to determine whether these generated values fits the theoretical density function given above.
Note: Invlude your computer routine for generating random variates in your answer sheet.

I need numerical solution

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

A. gen_obs <- function(){ u1 runif(1) if(u1 <= 2/3){ 2*runif(1) return(u) u = } else{ u = 2 + 8*runif(1) return(u) } نها obs repB.Histogram of obs 009 500 400 Frequency 300 200 100 0 0 4 9 oo 10 N obsC.ChiSquare goodness of fit test -- We divided into 5 bins and null probabilities are obtained by integrating within the interv

Add a comment
Know the answer?
Add Answer to:
Develop a generator for a random variable whose pdf is F(x) ={ 1/3, 0<=x<=2 1/24, 2<x<=10...
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
  • Given the pdf,f(x) = x2/9 on 0 < x 3, develop a generator for this distribution. Generate 1000 va...

    Given the pdf,f(x) = x2/9 on 0 < x 3, develop a generator for this distribution. Generate 1000 values of the random variate, compute the sample mean, and compare it to the true mean of the distribution Given the pdf,f(x) = x2/9 on 0

  • 5000) of uniformly distributed random numbers between 1 Generate a large number (1000 or and 2...

    5000) of uniformly distributed random numbers between 1 Generate a large number (1000 or and 2 (HINT: use the rand command for generating a uniformly distributed random variable between 0 and 1 and then move it!). b Plot the pdf of the distribution. Use the hist command to obtain the number of samples in a random numbers, define binx as a vector with bins on the x-axis (binx = 1:0.01:2). P histx,binx) will provide you the weights pdf. Compare with...

  • 4. Let X have the following PDF: sin(x) , 0 < x < π , otherwise...

    4. Let X have the following PDF: sin(x) , 0 < x < π , otherwise Ix(x) = 0 Find the CDF of X Using the Probability Integral Transformation Theorem, describe the process of generating values from the density of X Using R, generate 1,000 values using your process in part b. Produce a histogram of these generated values, and overlay the density curve of X over top. (Hint: in R, the function acos calculates the inverse cosine function.) Using...

  • #3.7 distribution. 0 and check that the mode of the generated samples is close to the...

    #3.7 distribution. 0 and check that the mode of the generated samples is close to the (check the histogram). theoretical mode mass function 3.5 A discrete random variable X has probability 3 4 AtB.8 HUS 2 X p(x) 0.1 0.2 0.2 0.2 0.3 a random sample of size Use the inverse transform method to generate 1000 from the distribution of X. Construct a relative frequency table and compare the empirical with the theoretical probabilities. Repeat using the R sample function....

  • Develop a random-variate generator using the inverse-transform technique for a random variable X with the pdf...

    Develop a random-variate generator using the inverse-transform technique for a random variable X with the pdf e2o0

  • 19. A random variable X has the pdf f(x) = 2/3 0 otherwise if 1 <...

    19. A random variable X has the pdf f(x) = 2/3 0 otherwise if 1 < x 2 (a) Find the median of X. (b) Sketch the graph of the CDF and show the position of the median on the graph.

  • 9. Let a random variable X follow the distribution with pdf f(z)=(0 otherwise (a) Find the...

    9. Let a random variable X follow the distribution with pdf f(z)=(0 otherwise (a) Find the moment generating function for X (b) Use the moment generating function to find E(X) and Var(X)

  • (1) Suppose the pdf of a random variable X is 0, otherwise. (a) Find P(2 <...

    (1) Suppose the pdf of a random variable X is 0, otherwise. (a) Find P(2 < X < 3). (b) Find P(X < 1). (e) Find t such that P(X <t) = (d) After the value of X has been observed, let y be the integer closest to X. Find the PMF of the random variable y U (2) Suppose for constants n E R and c > 0, we have the function cr" ifa > 1 0, otherwise (a)...

  • Generate N binary random variables Xi, i E {1,2,.., N] where X 1 or -1 with equal probability in ...

    Generate N binary random variables Xi, i E {1,2,.., N] where X 1 or -1 with equal probability in Matlab using rand or randn. According to central limit theorem, i= 1 should follow normal distribution when N is large. (1) Please plot the theoretical pdf of normal distribution (2) Please estimate the pdf of Vv by generating a lot of instances of Vv (hint: use hist command to get histogram then scaleit) (3) Please plot the theoretical pdf and the...

  • 2. Generate a large number of Gaussian distributed random numbers with mean 0 and variance 1....

    2. Generate a large number of Gaussian distributed random numbers with mean 0 and variance 1. (HINT: use the randn command) a) Provide a scatter plot of the random numbers b) Plot the pdf of the distribution (similar to 1) and compare with theoretical pdf given in the class handout. c) If I want to generate a Gaussian distributed random numbers with mean 2 and variance 9 from the previously generated set of random numbers, how would I do it?...

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