Question

Need to use Rstudio for this question A government grants is funding a study to calculate...

Need to use Rstudio for this question

A government grants is funding a study to calculate how long it takes for the average consumer to establish an Internet connection. A random sample of 20 Internet users’ connection time is collected. The connections time in seconds are

0.03, 0.48, 0.49, 0.52, 0.66, 0.67, 0.70, 0.76,0.82, 1.2, 1.22, 1.39, 1.62, 1.85, 1.97, 2.25, 2.84, 3.11, 3.48, 4.02

Use chi-square test to see if it is reasonable to assume that internet connection time follows an exponential distribution with a mean of 1.5 seconds.

\begin{tcolorbox} Hint:

• You need to generate 20 samples from exponential distribution using rexp function

• The dexp function in R uses rate in its argument, not mean. You need to revisit Week2 lecture note to find the conversion between rate and mean of exponential distribution.

• You will need to bin both expected and observed data before the test. You can use hist() function in R to bin the data. For example

#generate 100 random samples from normal distribution with mean 0

# and standard deviation of 1

set.seed(1234)

d<-rnorm(100, 0, 1)

z1<-hist(d)

z1$breaks

# shows the breaks of each bin. For example, the first bin contains values between -2.5 and -2.0

z1$counts

# frequency counts

The function hist may use different bin size for different data, therefore you will need to specify the breaks argument in the hist function.

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

Statistics and Probability

Need to use R-studio for this question

A government grants is funding a study to calculate how long it takes for the average consumer to establish an Internet connection. A random sample of 20 Internet users’ connection time is collected. The connections time in seconds are 0.03, 0.48, 0.49, 0.52, 0.66, 0.67, 0.70, 0.76, 0.82, 1.2, 1.22, 1.39, 1.62, 1.85, 1.97, 2.25, 2.84, 3.11, 3.48, 4.02.

Use chi-square test to see if it is reasonable to assume that internet connection time follows an exponential distribution with a mean of 1.5 seconds.

Answer:

Using chi-square test to see if it is reasonable to assume that internet connection time follows an exponential distribution with a mean of 1.5 seconds.

We have chi square p-value= 0.7167531. Hence it is concluded that internet connection time follows an exponential distribution with a mean of 1.5 seconds.

R code is below:

time<-c(0.03, 0.48, 0.49, 0.52, 0.66, 0.67, 0.70, 0.76,0.82, 1.2, 1.22, 1.39, 1.62, 1.85, 1.97, 2.25, 2.84, 3.11, 3.48, 4.02)

#################### Chi square test ###################

x.exp.cut<-cut(time,breaks=c(0, 1, 2, 3, 4.5)) ##binning data, identify breaks by hist(time$breaks)

observed<-table(x.exp.cut) ## binned data table

observed

## computing expected frequencies

mean=1.5

E1<-(pexp(1,rate=1/mean)-pexp(0,rate=1/mean))*length(time)

E2<-(pexp(2,rate=1/mean)-pexp(1,rate=1/mean))*length(time)

E3<-(pexp(3,rate=1/mean)-pexp(2,rate=1/mean))*length(time)

E4<-(pexp(4.5,rate=1/mean)-pexp(3,rate=1/mean))*length(time)

expected<-c(E1,E2,E3,E4) ## expected frequencies vector

chi<-sum((observed-expected)^2/expected)

df<-4-1

1-pchisq(chi,df) ## p-value

#[1] 0.7167531 # p-value chi-square

Add a comment
Know the answer?
Add Answer to:
Need to use Rstudio for this question A government grants is funding a study to calculate...
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
  • Q: Help in understanding and solving this example from Data Structure & Algorithms (Computer Science) with...

    Q: Help in understanding and solving this example from Data Structure & Algorithms (Computer Science) with the steps of the solution to better understand, thanks. **Using R studio language, thanks. R Lab: You need to use R commands and using R markdown to generate a report that interacted with statistics R. A sample program is provided. x =0:20 theta<-3 pdff<- (1/theta)*exp(-x/theta) cdff<- 1-exp(-x/theta) plot(x, pdff, type ='l') Instructions: 1. Use R command to generate a sample of random numbers from...

  • Please answer this question with RStudio. 4. In this problem, you will illustrate the idea of...

    Please answer this question with RStudio. 4. In this problem, you will illustrate the idea of resampling and sampling distributions. A ganma distribution with shape k and scale θ has density exp(-v/0) Assume shape k = 2 and scale θ = 3 (a) Use the function dgamma in R to evaluate the density for a range of values between 0 and 20. Produce a plot of the density (b) The (true) mean and variance of the gamma distribution are simple...

  • please I need help with excel or matlab part. part 3 Lab 1 BASIC DATA PROCESSING...

    please I need help with excel or matlab part. part 3 Lab 1 BASIC DATA PROCESSING PRE-LAB ASSIGNMENT 1. Read the lab manual carefully so you know what you have to do when you walk into the lab. 2. In a lab, the resistance of a resistor was measured using 50 samples giving the following values: 119.95 (6), 121.32 (5), 119.57 (7), 117.43(1), 120.76 (15), 120.67 (1), 119.78 (8), 121.43(3), 121.82(1), and 118.47 (3) 2 Estimate the average value of...

  • # 3. The following code draws a sample of size $n=30$ from a chi-square distribution with...

    # 3. The following code draws a sample of size $n=30$ from a chi-square distribution with 15 degrees of freedom, and then puts $B=200$ bootstrap samples into a matrix M. After that, the 'apply' function is used to calculate the median of each bootstrap sample, giving a bootstrap sample of 200 medians. "{r} set.seed (117888) data=rchisq(30,15) M=matrix(rep(0,30*200), byrow=T, ncol=30) for (i in 1:200 M[i,]=sample(data, 30, replace=T) bootstrapmedians=apply(M,1,median) (3a) Use the 'var' command to calculate the variance of the bootstrapped medians....

  • Instructions First, download real estate data from the city of Ames, Iowa: download.file("htt...

    Instructions First, download real estate data from the city of Ames, Iowa: download.file("http://www.openintro.org/stat/data/ames.RData", destfile = "ames.RData") load("ames.RData") Now write code in R to answer the following questions. Make sure the script that you turn in includes the code that you write, the output that you get from that code (in a comment), and a sentence or more answering the question if there was one (also in a comment). Consider the variable Gr.Liv.Area of the ames data frame, which represents the...

  • need letters (i), (j), (k), and (l), please and thank you Please write a 10 pages' statistical report how to study the length of sharks. You and use internet or other resources to obtain addit...

    need letters (i), (j), (k), and (l), please and thank you Please write a 10 pages' statistical report how to study the length of sharks. You and use internet or other resources to obtain additional information. The basic information is given below Great white are big and hungry. Here are the lengths in feet of the following great whites: 18.7 12.3 18.6 15.7 18.3 14.6 15.8 14.9 17.6 12.1 16.4 16.7 17.8 16.2 12.6 17.8 13.8 12.2 15.2 14.7 12.4...

  • You may need to use the appropriate appendix table or technology to answer this question Older...

    You may need to use the appropriate appendix table or technology to answer this question Older people often have a hard time finding work. AARP reported on the number of weeks it takes a worker aged 55 plus to find a job. The data on number of weeks spent searching for a job contained In the file JobSearch are consistent with the AARP findings. 21 14 51 16 12 14 16 12 4 0 13 24 19 28 26 26...

  • Hello experts, I need help answering the following question and its sub-questions please. I use M...

    Hello experts, I need help answering the following question and its sub-questions please. I use MINITAB for my data. Please show your work to make it easier for understanding! will upvote! Q-1) 7 marks Confidence interval for μ when σ 1s known. The duration of baseball games in the major league in the 2010 and 2011 scasons is uniformly distributed between 2.76 and 3.22 hours inclusive. We would like to simulate 50 samples of 30 gane duration time and construct...

  • You may need to use the appropriate appendix table or technology to answer this question Older...

    You may need to use the appropriate appendix table or technology to answer this question Older people often have a hard time finding work. A research group reported on the number of weeks it takes a worker aged 55 plus to find a job. The data on number of weeks spent searching for a job is given in the table below. 24 17 54 19 20 17 19 15 51 3 30 20 35 27 15 13 55 24 29...

  • TRY IT 1.11 You are going to use the random number generator to generate different types...

    TRY IT 1.11 You are going to use the random number generator to generate different types of samples from the data. This table displays six sets of quiz scores (each quiz counts 10 points for an elementary statistics class #1 #2 #3 34 #5 #6 5 7 10 9 8 10 5 9 8 7 6 9 10 8 6 7 9 9 10 10 9 8 9 7 8 9 5 7 4 9 9 9 10 8 7...

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
ADVERTISEMENT