Question

In: Statistics and Probability

Make sure all figures are clearly labeled (e.g., Figure 1, Figure 2, etc.), and include all...

Make sure all figures are clearly labeled (e.g., Figure 1, Figure 2, etc.), and include all R code used

to answer questions.

Simulating from distributions

For each of the following subproblems:

i. Plot the distribution you’re sampling from (e.g., if Xi∼Exp(λ), plot the exponential distribution with rate λ

ii. Generate a sample of size n= 10 from the distribution, and find the sample mean.

iii. Repeat step ii. 999 times (i.e.,k= 1000), and then plot a histogram of the samples.

iv. Add a plot of the approximate normal density on top of the histogram.

v. Repeat steps ii. – iv. with sample size n= 100.

Solutions

Expert Solution


R code:

n=10
x=matrix(0,nrow=1000,ncol=n)
m=1:1000*0
for(i in 1:1000)
{
x[i,]=runif(n, min = -2, max = 2)
m[i]=mean(x[i,])
}
hist(m, density=20, breaks=20, prob=TRUE,
xlab="x-variable", ylim=c(0, 1.4),
main="normal curve over histogram when n=10")
curve(dnorm(x,mean(m),sd(m)),col="blue", lwd=2, add=TRUE, yaxt="n")

R code:

n=100
x=matrix(0,nrow=1000,ncol=n)
m=1:1000*0
for(i in 1:1000)
{
x[i,]=runif(n, min = -2, max = 2)
m[i]=mean(x[i,])
}
hist(m, density=20, breaks=20, prob=TRUE,
xlab="x-variable", ylim=c(0, 4),
main="normal curve over histogram when n=100")
curve(dnorm(x,mean(m),sd(m)),col="blue", lwd=2, add=TRUE,

R code:

n=10
x=matrix(0,nrow=1000,ncol=n)
m=1:1000*0
for(i in 1:1000)
{
x[i,]=rgamma(n, 2,0.5)
m[i]=mean(x[i,])
}
hist(m, density=20, breaks=20, prob=TRUE,
xlab="x-variable", ylim=c(0, 0.6),
main="normal curve over histogram when n=10")
curve(dnorm(x,mean(m),sd(m)),col="blue", lwd=2, add=TRUE

R code:

n=100
x=matrix(0,nrow=1000,ncol=n)
m=1:1000*0
for(i in 1:1000)
{
x[i,]=rgamma(n, 2,0.5)
m[i]=mean(x[i,])
}
hist(m, density=20, breaks=20, prob=TRUE,
xlab="x-variable", ylim=c(0, 2),
main="normal curve over histogram when n=100")
curve(dnorm(x,mean(m),sd(m)),col="blue", lwd=2, add=TRUE, yaxt="n")

R code:

n=10
x=matrix(0,nrow=1000,ncol=n)
m=1:1000*0
for(i in 1:1000)
{
x[i,]=rpois(n, 1)
m[i]=mean(x[i,])
}
hist(m, density=20, breaks=20, prob=TRUE,
xlab="x-variable", ylim=c(0, 2),
main="normal curve over histogram when n=10")
curve(dnorm(x,mean(m),sd(m)),col="blue", lwd=2, add=TRUE, yaxt="n")

R code:

n=100
x=matrix(0,nrow=1000,ncol=n)
m=1:1000*0
for(i in 1:1000)
{
x[i,]=rpois(n, 1)
m[i]=mean(x[i,])
}
hist(m, density=20, breaks=20, prob=TRUE,
xlab="x-variable", ylim=c(0, 4),
main="normal curve over histogram when n=100")
curve(dnorm(x,mean(m),sd(m)),col="blue", lwd=2, add=TRUE, yaxt="n")

R code:

n=10
x=matrix(0,nrow=1000,ncol=n)
m=1:1000*0
for(i in 1:1000)
{
x[i,]=rgeom(n, 0.2)
m[i]=mean(x[i,])
}
hist(m, density=20, breaks=20, prob=TRUE,
xlab="x-variable", ylim=c(0, 0.5),
main="normal curve over histogram when n=10")
curve(dnorm(x,mean(m),sd(m)),col="blue", lwd=2, add=TRUE, yaxt="n")

R code:

n=100
x=matrix(0,nrow=1000,ncol=n)
m=1:1000*0
for(i in 1:1000)
{
x[i,]=rgeom(n, 0.2)
m[i]=mean(x[i,])
}
hist(m, density=20, breaks=20, prob=TRUE,
xlab="x-variable", ylim=c(0, 2),
main="normal curve over histogram when n=100")
curve(dnorm(x,mean(m),sd(m)),col="blue", lwd=2, add=TRUE, yaxt="n")


Related Solutions

INCLUDE: all Hypothesis Tests must include all four steps, clearly labeled all Confidence Intervals must include...
INCLUDE: all Hypothesis Tests must include all four steps, clearly labeled all Confidence Intervals must include all output as well as the CI itself include which calculator function you used for each problem At a community college, the mathematics department has been experimenting with four different delivery mechanisms for content in their Statistics courses. One method is traditional lecture (Method I), the second is a hybrid format in which half the time is spent online and half is spent in-class...
Make sure to include comments that explain all your steps (starts with #) Make sure to...
Make sure to include comments that explain all your steps (starts with #) Make sure to include comments that explain all your steps (starts with #) Write a program that prompts the user for a string (a sentence, a word list, single words etc.), counts the number of times each word appears and outputs the total word count and unique word count in a sorted order from high to low. The program should: Display a message stating its goal Prompt...
a. all Hypothesis Tests must include all four steps, clearly labeled; b. all Confidence Intervals must...
a. all Hypothesis Tests must include all four steps, clearly labeled; b. all Confidence Intervals must include all output as well as the CI itself c. include which calculator function you used for each problem. 2. An experiment was done to see whether open-book tests make a difference. A calculus class of 48 students agreed to be randomly assigned by the draw of cards to take a quiz either by open-notes or closed-notes. The quiz consisted of 30 integration problems...
a. all Hypothesis Tests must include all four steps, clearly labeled; b. all Confidence Intervals must...
a. all Hypothesis Tests must include all four steps, clearly labeled; b. all Confidence Intervals must include all output as well as the CI itself c. include which calculator function you used for each problem. 3. At a community college, the mathematics department has been experimenting with four different delivery mechanisms for content in their Statistics courses. One method is traditional lecture (Method I), the second is a hybrid format in which half the time is spent online and half...
a. all Hypothesis Tests must include all four steps, clearly labeled; b. all Confidence Intervals must...
a. all Hypothesis Tests must include all four steps, clearly labeled; b. all Confidence Intervals must include all output as well as the CI itself c. include which calculator function you used for each problem. 3. The authors of the paper “Statistical Methods for Assessing Agreement Between Two Methods of Clinical Measurement” (International Journal of Nursing Studies [2010]: 931-936) compared two different instruments for measuring a person’s ability to breathe out air. (This measurement is helpful in diagnosing various lung...
a. all Hypothesis Tests must include all four steps, clearly labeled; b. all Confidence Intervals must...
a. all Hypothesis Tests must include all four steps, clearly labeled; b. all Confidence Intervals must include all output as well as the CI itself c. include which calculator function you used for each problem. 2. An experiment was done to see whether open-book tests make a difference. A calculus class of 48 students agreed to be randomly assigned by the draw of cards to take a quiz either by open-notes or closed-notes. The quiz consisted of 30 integration problems...
a. all Hypothesis Tests must include all four steps, clearly labeled; b. all Confidence Intervals must...
a. all Hypothesis Tests must include all four steps, clearly labeled; b. all Confidence Intervals must include all output as well as the CI itself c. include which calculator function you used for each problem. 3. At a community college, the mathematics department has been experimenting with four different delivery mechanisms for content in their Statistics courses. One method is traditional lecture (Method I), the second is a hybrid format in which half the time is spent online and half...
Provide all relevant Minitab output, and make sure the responses are organized and are clearly written....
Provide all relevant Minitab output, and make sure the responses are organized and are clearly written. Suppose an investigator is interested in the weight (pounds) of a certain type of fish. They collect a random sample of 26 fish from a lake. The resulting data is compiled in the table below. Assume the data is normally distributed. Observation | Weight 1 11.73 2 13.33 3 12.65 4 12.54 5 12.67 6 10.55 7 13.24 8 11.09 9 12.28 10 12.38...
Pick a subculture within the U.S., (e.g., bikers, goths, etc.) and clearly explain why it is...
Pick a subculture within the U.S., (e.g., bikers, goths, etc.) and clearly explain why it is called a subculture. Also explain why it came into social existence, as well as identify what utility it serves for group members. Lastly, describe the similarities and differences between the subculture you selected and the dominant/mainstream culture in the U.S.
Pick a subculture within the U.S., (e.g., bikers, goths, etc.) and clearly explain why it is...
Pick a subculture within the U.S., (e.g., bikers, goths, etc.) and clearly explain why it is called a subculture. Also explain why it came into social existence, as well as identify what utility it serves for group members. Lastly, describe the similarities and differences between the subculture you selected and the dominant/mainstream culture in the U.S.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT