open parentheses table row 1926 row 1851 row 1872 end table close parentheses comma capital sigma subscript 0 equals open parentheses table row 100 0 0 row 0 100 0 row 0 0 100 end table close parentheses. end cell end table"/>
Based on (3.30) and (3.31), the following R
codes calculate the posterior mean and covariance matrix for μ using the first five (n = 5) observations in the data set.
Sigma <- matrix(c(2547.4, -111.0, 133.7, -111.0, 533.1, 300.7, 133.7, 300.7, 562.5), nrow = 3, ncol = 3, byrow = T) Precision <- solve(Sigma) Sigma0 <- diag(rep(100, 3)) Precision0 <- solve(Sigma0) mu0 <- c(1926, 1851, 1872) n <- 5 X.n <- side.temp.defect[1:n, c(2, 40, 78)] x.bar <- apply(X.n, 2, mean) mu.n <- solve(Precision0+n*Precision)%*% (Precision0%*%mu0+n*Precision%*%x.bar) Sigma.n <- solve(Precision0 + n*Precision)
The posterior mean and covariance matrix are obtained as
Compared to the sample mean of the first five observations, which is (1943 1850 1838)T, the posterior mean has some deviations from both the sample mean and the prior mean μ0. Now we use the first 100 (n = 100) observations to find the posterior mean by changing n
in the R
codes from 5 to 100. The posterior mean and covariance matrix are
Compared to the sample mean vector of the first 100 observations, which is (1944 1849 1865)T, the posterior mean with n = 100 observations is very close to the sample mean, while the influence of the prior mean is very small. In addition, the posterior variance for the mean temperature at each of the three locations is much smaller for n = 100 than for n = 5.
Bibliographic Notes
Multivariate normal distribution and its inference are thoroughly discussed in multivariate statistics books, for example, Johnson et al. [2002], Rencher [2003], and Anderson [2003]. Particularly, proofs of many theoretical results and properties can be found in Anderson [2003].
Exercises
1 Consider two discrete random variables X and Y with joint probability mass function p(x, y) given in the following table:
x | y | p(x, y) |
---|---|---|
–1 | –1 | 0.24 |
–1 | 1 | 0.06 |
0 | –1 | 0.16 |
0 | 1 | 0.14 |
1 | –1 | 0.40 |
1 | 1 | 0.00 |
1 Find the mean vector, the covariance matrix, and the correlation matrix of the random vector (X Y )T.
1 A random vector X = (X1 X2 X3 X4)T has mean vector and covariance matrix given as
1 Let and . Please findE(X1)E(AX1)cov(X1)var(AX1)E(X2)E(BX2)cov(X2)cov(BX2)
1 Repeat Exercise 2, but with A and B replaced by
1 Let X = (X1 X2 X3)T be a random vector with X ∼ N(μ, Σ) with
1 Which of the following random variables are independent? Please explain.X1 and X2X2 and X3X1 and X3(X1, X2) and X3 and X3
1 Consider the random vector X in Exercise 2.Find the distribution of X2 + X3 + X4.Find the distribution of 3X2 − 2X3 + X4.Find the joint distribution of X2 + X3 + X4 and 3X2 − 2X3 + X4.Find the distribution of X1 − X2 + 2X3 + X4Find a 2×1 vector c such that X2 and are independent.Find a 2×1 vector c such that X2 and are independent.
2 Consider the random vector in Exercise 4.Find the conditional distribution of X1, given that X3 = x3.Find the conditional distribution of X1, given that X2 = x2.
3 Consider the random vector X in Exercise 2.Find the conditional distribution of X1, given that X2 = x2 and X3 = x3.Find the conditional distribution of X2, given that X3 = x3 and X4 = x4.Find the conditional distribution of X3, given that X2 = x2 and X4 = x4.Find the conditional distribution of (X2 X3)T, given that X4 = x4.
4 Calculate by hand the maximum likelihood estimates of the mean vector μ and the covariance matrix Σ of (X2 X3)T based on the first five observations of the last two variables in Table 2.1, assuming the observations are from a bivariate normal population.
5 Consider a random sample of size n = 3 from a bivariate normal population as shown in the following table.
x 1 | x 2 |
---|---|
5 | 8 |
9 | 5 |
7 | 2 |
1 Evaluate the T2-statistic used to test H0 : μ = μ0 based on this data set, where μ0 (8 4)T. What is the distribution of the T2-statistic in this case?
1 Consider the data from a bivariate normal population in the following table: