University of Missouri Columbia Exploring Confident Intervals Questions
Your Name Here
## — Attaching packages ——————————————————————————
## v ggplot2
## v tibble
## v tidyr
## v readr
3.3.2 v purrr 0.3.4
3.0.3 v dplyr 1.0.2
1.1.2 v stringr 1.4.0
1.3.1 v forcats 0.5.0
## — Conflicts —————————————————————————————
## x dplyr::filter() masks stats::filter()
## x dplyr::lag() masks stats::lag()
## Attaching package: ‘lubridate’
## The following objects are masked from ‘package:base’:
## date, intersect, setdiff, union
You just need to load in the data and do some pre-processing. Notice that there are 25 different data files, so
we will need to do something a little different here. NOTE, you NEED to make sure the lab_5_data folder
is in the same directory as your R Markdown (or R) script. We create a vector called files that stores the
file path for each files, and then use the lapply() function to load in every element in the vector. As a
general outline, we need to
Load in all the data files (this has been done for you),
Rename all column names to remove spaces and backslashes,
Change the Date, Start_Time, and End_Time columns to be time referenced (think back to a previous
Change the Position_Name column to reduce the number of positions to be Midfielder, Striker,
Goal Keeper, Defender, and Wing (from previous lab).
files = list.files(‘lab_5_data’, pattern=”*.csv”, full.names=TRUE)
dat = lapply(files, read_csv, col_types = cols()) %>%
rename_all() %>% #### FILL IN
rename_all() %>% #### FILL IN
mutate(Date = , #### FILL IN
Start_Time = , #### FILL IN
End_Time = ) %>% #### FILL IN
mutate(Position_Name = ) #### FILL IN
Here we are going to start exploring confident intervals (sort of). Looking at the four metrics
Player_Load_Per_Minute, Meterage_Per_Minute, Maximum_Velocity, and Total_Distance, we want to
plot the 95% confidence interval by position over time. Note that in the R chunk statement, I have included
a couple extra arguments; please do not delete these, they are only there to size your final plot. For the data
construction step, our general outline is
1. Select the appropriate columns,
2. Filter out NAs
3. Pivot from wide to long format
4. Find the mean, lower CI, and upper CI grouping by position, date, and metric.
Then, to plot this, our general outline is
Choose the x variable,
Choose the y variable,
Choose if you want to color and/or fill the lines/bounds by a variable (probably should do this),
Make a line,
Use geom_ribbon() to create the CI, where you pass in what the lower bound should be and what the
upper bound should be,
Make the plot pretty (e.g., proper labels, perhaps a legend is not needed, etc.).
mean, lower C
nds. We supply
dat_ci = %>% #### FILL IN
select(Date, Position_Name, Period_Name, ) %>% #### FILL IN
filter(complete.cases(.)) %>% # This removes any NAs that are in the data
filter(Period_Name != ‘Session’) %>% # This is discussed on Q3
pivot_longer(, names_to = ‘Metric’, values_to = ‘Values’) %>% #### FILL IN
group_by() %>% #### FILL IN
summarise_at(vars(Values), list(mean = mean, # This creates 3 new summary variables, the
lower = ~ quantile(.,probs = 0.025),
upper = ~ quantile(.,probs = 0.975))) %>%
ggplot(, aes(x = , y = , color = , fill = )) + #### FILL IN
geom_line() + # creates a line plot
geom_ribbon(aes(ymin = lower, ymax = upper), alpha=0.3) + # here are your confidence bou
facet_wrap(~ , scale=”free_y”, nrow = 5) + #### FILL IN
scale_x_date() #### FILL IN
For this question, instead of filling in/writing your own code, you will be analyzing what I did. The “Question
3” code chunk below has four different comments, each is associated with a number. You need to answer the
comment that is associated with the same numbered bullet point.
Why do we filter out all rows where the Period_Name is Session?
What do these four lines of code do?
What do these four lines of code do?
What is the effect of having the pivot_longer statement before the summarize_at statement? What
would happen if they were switched?
Below are four figures, Figures 1, 2, 3, and 4, that are created using the constructed data from part a. NOTE,
you will need to load in the data from Question 1 for the figures to show up. For the four figures below,
answer the following:
Is it better to represent the data as percent of time spent in each band, or would it have been better to
not transform the data and plot the raw values (i.e., the values contained in the original data)? Explain.
Are the four figures comparable? Explain.
Are the figures meaningful, and if so, what conclusions can you draw from them?
Is it better to have all of the y-axis on the same scale (withing figures and/or across figures), or should
the y-axis be specific to each subplot?
Our customer is the center of what we do and thus we offer 100% original essays..
By ordering our essays, you are guaranteed the best quality through our qualified experts.All your information and everything that you do on our website is kept completely confidential.
Academicwritingcompany.com always strives to give you the best of its services. As a custom essay writing service, we are 100% sure of our services. That is why we ensure that our guarantee of money-back stands, alwaysRead more
The paper that you order at academicwritingcompany.com is 100% original. We ensure that regardless of the position you are, be it with urgent deadlines or hard essays, we give you a paper that is free of plagiarism. We even check our orders with the most advanced anti-plagiarism software in the industry.Read more
The Academicwritingcompany.com thrives on excellence and thus we help ensure the Customer’s total satisfaction with the completed Order.To do so, we provide a Free Revision policy as a courtesy service. To receive free revision the Academic writing Company requires that the you provide the request within Fifteen (14) days since the completion date and within a period of thirty (30) days for dissertations and research papers.Read more
With Academicwritingcompan.com, your privacy is the most important aspect. First, the academic writing company will never resell your personal information, which include credit cards, to any third party. Not even your lecturer on institution will know that you bought an essay from our academic writing company.Read more
The academic writing company writers know that following essay instructions is the most important part of academic writing. The expert writers will, therefore, work extra hard to ensure that they cooperate with all the requirements without fail. We also count on you to help us provide a better academic paper.Read more