

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
It includes some R computations and exercises for Stats.
Typology: Exercises
1 / 3
This page cannot be seen from the preview
Don't miss anything!


University of Geneva Statistics
Fall semester Practical 3
Goals: This practical is the continuation of practical 2 in Exploratory Data Analysis, but this time we do analysis on numerical data. Numerical variables including discrete variables and continuous variables can be numerically summarized by quantiles and some other statistics measuring center or dispersion. And these statistics can also be visualized by frequency tables, cumulative distributions, histograms/barplots, kernel density plots, boxplots, violin plots, Q-Q plots. The goal of this practical is to further familiarize with R, and in turn to better understand these summary statistics.
In this part of the practical we see how to represent data through tables and extract some information from them. For this purpose consider a dataset recording the wins, defeats and goals of the Geneva hockey team HC Servette. The variables in file Hockey.csv are as follows:
Hockey = read. table ( " path / Hockey. csv " , sep = " ; " , header = TRUE )
str ( Hockey ) class ( Hockey $ HomeMatch ) class ( Hockey $ Winner )
Supposing that the event of playing a home or away match is random, answer the following questions using the R functions table() and xtabs().
University of Geneva Statistics
Fall semester Practical 3
(a) What is the probability that HC Servette scores exactly 3 goals?
(b) What is the probability that HC Servette has more than 4 goals scored against them?
(a) How many home matches did they lose?
(b) What is the probability that they win a match?
(c) What is the probability that they lose an away match?
(d) What is the probability that they win a match knowing that it is a home match?
Bonus: What would the expected number of away defeats be if winning or losing were independent of the fact of playing a home or an away match?
For discrete numerical data, we can either use the function hist() or barplot(), but with some care.
We can alternatively use the function barplot (designed for categorical variables).
For the correct plot,