MAT013 Class Test 2017

Instructions:

Once you have finished the test:

  1. Call the file for the SAS code: STUDENTNUMBER-SAS-lastname (eg. 123456-SAS-Evans) and call the file for the R code: STUDENTNUMBER-R-lastname (eg. 123456-R-Evans).
  2. Email both files to Lauren Trundle with ‘MAT013-STUDENTNUMBER-lastname’ as the subject.
  3. The email must be sent before leaving the computer lab.
  4. Show the sent email to the class test invigilator.


Questions for the class test:

Download two datasets champ-15-16.csv and champ-16-17.csv. These files contains the football games in the Championship league in the season 2015/2016 and the season 2016/2017, respectively. Values in these files are separated by comma. Meaning of column names is explained here.

Please, answer half of following questions using SAS and another half of questions using R:

  1. Import two datasets champ-15-16.csv and champ-16-17.csv.
    Create a table by concatenating of these two datasets.
    In further questions, use this table for analysis.

    [5]

  2. Compute and show the average number of goals scored at home for each team.
    Compute and show the average number of goals scored away for each team.
    Compute and show the difference of the average number of goals scored at home and the average number of goals scored away for each team.

    [15]

  3. Extract a table with games where the team "Derby" played (either at home or away).
    Export this table to a csv-file with name "Derby-games.csv".

    [5]

  4. Compute and show the home winning percentage for each team (among games played at home).
    Compute and show the away winning percentage for each team (among games played away).
    Compute and show the home advantage (i.e., the difference of the home winning percentage and the away winning percentage) for each team.

    [15]

  5. Append the column with the total number of goals for the 2nd half (say, HT2G) and the column with the total number of goals for the 1st half (say, HT1G).
    Hint: HT1G=HTHG+HTAG and HT2G=FTHG+FTAG-HTHG-HTAG.
    Produce the histogram of HT2G and the histogram of HT1G.
    Compute the cross contingency table and the cross frequency table for HT2G and HT1G.
    Compute the correlation coefficient between HT2G and HT1G.

    [10]

  6. Build a linear model of HT2G with predictor HT1G.
    Build a linear model of HT2G with predictors HTHG and HTAG.

    [10]

  7. Compute the average number of yellow cards (HY+AY) for each referree.
    Perform the analysis of variance on influence of a referee on the number of yellow cards.
    Perform the analysis of variance on influence of a referee on the number of booking points (HBP+ABP). What is your conclusion?

    [10]

  8. Perform the analysis of variance on influence of a team on the number of corners earned by this team.

    [20]

  9. Consider a betting strategy of placing 1 pound bets on Draw when odds on a home team (the column BbMxH) is larger than 2 and smaller than 4. Compute the profit for this strategy. Recall that the balance decreases by 1 pound as we placed a bet and increases by a BbMxD value (i.e. odds on Draw) if a game finished by Draw.

    [10]