Morning Section Times: 39 35 39 39 40 37 41 39 42 40 37 35 38 36 40 35 38 36 39
ID: 3217242 • Letter: M
Question
Morning Section Times: 39 35 39 39 40 37 41 39 42 40 37 35 38 36 40 35 38 36 39 35 38 35 39 38 41 39 38 40 38 41 41 37 34 41 37 41 35 39 36 41 Evening Section Times: 35 47 29 34 26 34 38 45 44 49 37 37 37 37 40 26 29 30 23 38 32 36 45 39 31 42 41 35 34 43 31 30 37 36 33 Create two variables, morning and evening, which contain the respective commuting times. You can enter them into R using the scan() function; I suggest that you copy and paste the data from the txt file. As for R Assignment number 2, for each of the following questions, carry out all calculations using your R Script, then, for each question, copy and paste the commands and the output from the R console into a Word document Part 1Compute the sample means and standard deviations for each section's data. Copy and paste the commands and the values into your Word document. Part 2 We wish to calculate 95% confidence intervals for each of the morning and evening population means. Decide which you should use for each case, a normal quantile (z_alpha/2) or a Student's t quantile (t_n-1, a/2), where (1-alpha)=, 95. Using the R function, qnor m() or qt() respectively, compute the required quantile. Copy and paste the value into your Word document.Explanation / Answer
Part 1
First we can create 2 vectors of Morning and Evening times as below:
MorningTimes <- c(39,35,39,39,40,37,41,39,42,40,37,35,38,36,40,35,38,36,39,35,
38,35,39,38,41,39,38,40,38,41,41,37,34,41,37,41,35,39,36,41)
EveningTimes <- c(35,47,29,34,26,34,38,45,44,49,37,37,37,37,40,26,29,30,23,38,
32,36,45,39,31,42,41,35,34,43,31,30,37,36,33)
Mean can be calculated using mean function and standard deviation can be calculated using sd function.
MeanMorningTimes <- mean(MorningTimes)
MeanMorningTimes
38.225
MeanEveningTimes <- mean(EveningTimes)
MeanEveningTimes
36
SdMorningTimes <- sd(MorningTimes)
SdMorningTimes
2.189573
SdEveningTimes <- sd(EveningTimes)
SdEveningTimes
6.164414
Part 2. As our sample size is more than 30 for both morning and evening times we can use the normal distribution. So qnorm function can be used for calculating confidence intervals.
95% Confidence interval for morning times:
#95% confidence interval, right side
qnorm(0.975, mean = MeanMorningTimes, sd = SdMorningTimes) #42.51648
#95% confidence interval, left side
qnorm(0.025, mean = MeanMorningTimes, sd = SdMorningTimes) #33.93352
So 95% confidence interval for morningtime is (33.93352,42.51648)
95% Confidence interval for evening times:
#95% confidence interval, right side
qnorm(0.975, mean = MeanEveningTimes, sd = SdEveningTimes) #48.08203
#95% confidence interval, left side
qnorm(0.025, mean = MeanEveningTimes, sd = SdEveningTimes) #23.91797
So 95% confidence interval for evening time is (23.91797,48.08203)
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.