1. (6 marks) A random variable, X, measures a European football team’s net goal differ ence (goals scored minus goals conceded) for matches in a semi-professional league. The values X =-1, 0, 1 indicate negative, null or positive goal difference, respectively. X is thought to follow the probability distribution below:
a. (2 marks) Complete the table below by computing the values of the probability mass function, P (x), and the cumulative distribution function, F (x).
b. (2 marks) Compute the expected value of X by writing an R function to do the calculation (show your R code).
(b) The expected value is found as
The R function to calculate the above expected value below.
EX <- function ()
{
X <- c(-1,0,1)
PX <- (X+2)^2/14
EX <- sum(X*PX)
return(EX)
}
E <- EX()
Comments