Question

In: Statistics and Probability

In r-studio, given X=rpois(200,2). Generate a poisson probability histogram with lambda=2 and a relative frequency histogram...

In r-studio, given X=rpois(200,2). Generate a poisson probability histogram with lambda=2 and a relative frequency histogram of the sample on the same graph-------- //answer this only if youre familiar with R studio and know how to using it. not handwritten//

Solutions

Expert Solution

Here we use R-studio

#The R-code is

X=rpois(200,2)

Prob=dpois(0:8,2) #Probaility for Poisson

F=200*Prob # Expected Frequency

Y=rep(0:8,F)

c1=rgb(173,216,230,max = 255, alpha = 80, names = "lt.blue")#colour

c2=rgb(255,192,203, max = 255, alpha = 80, names = "lt.pink")#colour

hist(X,col=c1,breaks=7,freq=FALSE)

hist(Y,col=c2,add=T,breaks=7,freq=FALSE)

legend("topright",legend=c("Random numbers from Poisson 2","Poisson distribution with lambda=2"),fill=c(c1,c2))

#The output of the code is

>X=rpois(200,2)

>Prob=dpois(0:8,2) #Probaility for Poisson

>F=200*Prob # Expected Frequency

>Y=rep(0:8,F)

>c1=rgb(173,216,230,max = 255, alpha = 80, names = "lt.blue")#colour

>c2=rgb(255,192,203, max = 255, alpha = 80, names = "lt.pink")#colour

>hist(X,col=c1,breaks=7,freq=FALSE)

>hist(Y,col=c2,add=T,breaks=7,freq=FALSE)

>legend("topright",legend=c("Random numbers from Poisson 2","Poisson distribution with lambda=2"),fill=c(c1,c2))

#Here freq=FALSE for relative frequency


Related Solutions

(R programming) Generate 50 samples from a Poisson distribution with lambda to be 2 and define...
(R programming) Generate 50 samples from a Poisson distribution with lambda to be 2 and define the log likelihood function Use optimization to find the maximum likelihood estimator of lambda. Repeat for 100 times using forloop. You will need to save the results of the estimated values of lambda.
Create a histogram and relative frequency histogram for the data in table #2.2.10. Describe the shape...
Create a histogram and relative frequency histogram for the data in table #2.2.10. Describe the shape and any findings you can from the graph. Table #2.2.10: Data of Median Income for Females $31,862 $40,550 $36,048 $30,752 $41,817 $40,236 $47,476 $40,500 $60,332 $33,823 $35,438 $37,242 $31,238 $39,150 $34,023 $33,745 $33,269 $32,684 $31,844 $34,599 $48,748 $46,185 $36,931 $40,416 $29,548 $33,865 $31,067 $33,424 $35,484 $41,021 $47,155 $32,316 $42,113 $33,459 $32,462 $35,746 $31,274 $36,027 $37,089 $22,117 $41,412 $31,330 $31,329 $33,184 $35,301 $32,843 $38,177 $40,969...
Consider a Poisson probability distribution with lambda equals5.3 . Determine the following probabilities. ​a) exactly 5...
Consider a Poisson probability distribution with lambda equals5.3 . Determine the following probabilities. ​a) exactly 5 occurrences ​b) more than 6 occurrences ​c) 3 or fewer occurrences
Suppose the probability mass function of a random variable X is given by ??x−1?pr(1−p)x−r, ifx=r,r+1,r+2,... f(x)...
Suppose the probability mass function of a random variable X is given by ??x−1?pr(1−p)x−r, ifx=r,r+1,r+2,... f(x) = r−1 0, otherwise If this is the case then we say X is distributed as a Negative Binomial Random Variable with parameters r and p and we write X ∼ NegBin(r, p) (a) If we set r = 1, what distribution do we get? (b) Explain what this random variable models and justify the formula. (Hint: See Section 4.8.2 in Ross.) Math 241...
Assume X is a Poisson random variable with parameter lambda. What is the test statistic and...
Assume X is a Poisson random variable with parameter lambda. What is the test statistic and the best critical region for testing H_0:lambda = lambda_0        versus H_a:lambda = lambda_1 where lambda_0 < lambda_1 are constants?
Please use R studio, Thank you. 2. The probability of a student passing statistics is known...
Please use R studio, Thank you. 2. The probability of a student passing statistics is known to be 0.41; and the probability of a student passing chemistry is known to be 0.55. If the probability of passing both is known to be 0.35, calculate: (a) the probability of passing at least one of statistics and chemistry (b) the probability of a student passing chemistry, given that they passed statistics (c) Are passing chemistry and statistics independent? Justify (d) (harder) a...
Compute E(S^2) and V(S^2) if Xi follows the Poisson distribution with \lambda.
Compute E(S^2) and V(S^2) if Xi follows the Poisson distribution with \lambda.
THIS QUESTION REQUIRES THE USE OF R STUDIO. ANY ANSWERS GIVEN THAT ARE NOT IN R...
THIS QUESTION REQUIRES THE USE OF R STUDIO. ANY ANSWERS GIVEN THAT ARE NOT IN R STUDIO CODE WILL NOT SUFFICE. SOLVING WITHOUT THE USE OF R STUDIO IS NOT ACCEPTABLE. The previous question was: Annual salaries for a large company are approximately normally distributed with a mean of 49000 dollars and a standard deviation of 2000 dollars. One manager claims that all of his direct reports are paid "above the 75th percentile" for the company. What is the minimum...
Determine whether the following are examples of theoretical probability, subjective probability, or relative frequency. a) After...
Determine whether the following are examples of theoretical probability, subjective probability, or relative frequency. a) After taking the exam you believe there is a 90% chance that you passed. b) Last month the bus was on time 70% of the time so you believe that there is a 70% chance that the bus will be on time today. c) Your friend tells you her job interview went well and she believes there is a 75% chance that she will get...
what is correct About relative frequency distribution histogram(more can be choosen) 1. the total area of...
what is correct About relative frequency distribution histogram(more can be choosen) 1. the total area of all bars is equal to 1 2. the trial area of all bars is equal to the number of values in a sample 3. the total height of all bars are equal to 1. 4. the height of the bars highly depends on number of bins 5. the height of a bar is a percent values in the corresponding bin divided to its width...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT