CS代考计算机代写 —
—
title: “R Notebook”
output: html_notebook
—
“`{r include=FALSE}
if(!require(tidyverse)) install.packages(“tidyverse”)
if(!require(car)) install.packages(“car”)
library(tidyverse)
library(car)
“`
# Question [45 marks]
In the population, the average typing speed is 42.2 words per minute (wpm). A team of scientists wanted to investigate whether using specialised typing tutor software can improve the typing speed and conducted a set of experiments which involved 36 participants. At the end of these experiments, the typing speed of each participant was recorded in the **df_typing_speed** dataframe that is given below.
“`{r}
df_typing_speed <- data.frame(
participant_id = 1:36,
wpm = c(41.1, 43.4, 42.9, 46.8, 43.9, 40.5, 42.1, 42.7, 44.8, 40.6, 41.5, 41.2, 42.8, 41.1, 44.3, 44.8, 43.4, 45.5, 45.1, 40.8, 43, 42.7, 44.5, 42.5, 42.5, 43.6, 44, 39.5, 44, 44.9, 45, 42.8, 45.9, 46, 42.3, 40)
)
```
At 0.05 significance level:
1. Calculate the corresponding test statistic for the hypothesis test that will investigate if there is evidence to suggest that using the specialised typing tutor software will lead to a difference in typing performance. NOTE: round solution to 3 decimal places
2. Calculate the p-value of this test statistic. NOTE: round solution to 3 decimal places.
3. State the conclusion you would make about the null hypothesis based on your above results.
4. Calculate a 95% confidence interval for the new unknown mean typing speed and comment on your results. NOTE: round solution to 3 decimal places.
## Solutions
H0 <- mu0 != mu1
HA <- mu0 - mu1 = 0
1.
```{r}
mu0 <- 42.2
mean_typing_speed <- mean(df_typing_speed$wpm)
sd_typing_speed <- sd(df_typing_speed$wpm)
n <- 36
z <- (mean_typing_speed - mu0)/sqrt(sd_typing_speed^2/n)
paste0 ("z= ", round(z,3))
```
2.
```{r}
p_value <- pnorm(z) %>% round(3)
paste0 (“p_value = “, p_value)
“`
3.
“`{r}
“`
4.
“`{r}
z_critical <- qnorm(0.975)
ci <- c(
mean_typing_speed - z_critical * sqrt(sd_typing_speed^2/n),
mean_typing_speed + z_critical * sqrt(sd_typing_speed^2/n)
)
ci <- round (ci, 3)
paste0("95% C.I. is [",ci[1],",",ci[2],"]")
```