Homework 3 – Due 12 am CST, 26 February 2012

advertisement
Homework 3 – Due 12 am CST, 26 February 2012
The total points on this assignment is 125. The dataset is posted on the class website. For this homework,
there is no need to turn in any software code, however, you are required to turn in the results.
1. Let X1 , X2 , . . . , Xn be independent identically distributed (univariate) random variables from the
N (µ, σ 2 ) distribution. Answer the following questions:
(a) Provide the conditional distribution of X1 , X2 , . . . , Xn−1 given X̄. [7 points]
(b) Write a function in R which will generate a random vector X where X = (X1 , X2 , . . . , Xn ) given
Pn−1
X̄. (Note that Xn = nX̄ − i=1 Xi .) [10 points]
(c) The file provided at the usual places (file fMRI.txt) contains a 128 × 128 Magnetic Resonance
Image (MRI) slice of the human brain. You may use the following in R to read and display the
image:
x <- matrix(scan(file =
"http://www.public.iastate.edu/~maitra/stat501/datasets/fMRI.txt"),
ncol = 128, by = T)
image(x[,128:1], col = gray(0:16/16))
The observation at each pixel (grid-point) is normally distributed with some (pixel-specific) mean
µ and common variance σ 2 /16 = 0.0122 . We will try and predict the image at a higher resolution.
To do so, assume that the observation at each pixel is actually the mean at each of 16 pixel,
where each pixel can actually be subdivided into 4 pixels in both the x- and y- directions. Note
that this is a computationally-intensive exercise so you are encouraged to think about an efficient
implementation to the programming.
(d) Provide a display of the derived (higher resolution) image. Note that the higher-resolution image
will be of lower quality in general because of the information lost in compressing it in the first
place. [8 points]
2. Our next goal will be a limited investigation and comparison of the performance of the χ2p test of
the book (using the Kolmogorov-Smirnov test ks.test in R), the practical simulation-based approach
discussed in class, and the test using the energy statistics, to determining multivariate normality
of a sample. Our basic approach in this assignment will be to investigate performance in terms of
distinguishing samples from fatter-tailed distributions from the normal, and to see how performance
tapers down as the “fat” parameter is tamped down to become more normal. To see this, we will need
to have some more discussion.
(a) The Multivariate t-distribution with ν degrees of freedom. The p-variate t-distribution with degrees
of freedom ν (see Lange, et al., 1989) with mean parameter µ and dispersion Σ is denoted by
tp (µ, Σ, ν) and has density
1
fν (x | µ, Σ) ∝ |Σ|− 2 {ν + (x − µ)0 Σ−1 (x − µ)}−
ν+p
2
,
x ∈ <p .
A random vector V has the tp (µ, Σ, ν) density, if, analogous to the univariate case, V = µ +
√
1
Σ 2 Z/ U , where Z ∼ Np (0, I p ) is independent of U ∼ χ2ν . This representation makes it possible
to obtain realizations from the multivariate t distribution.
The above provides for an approach to simulating random vector-valued realizations from the
multivariate t-distribution. You may use the above to develop your own function, or use the
Stat 501, Spring 2012 – Maitra
2
functions (e.g., rmvt) available in contributed R packages (e.g., mvtnorm). We will also see
how the sample size influences performance. Our strategy therefore will be as follows: generate
n = 20, 50, 250 samples each from tp (µ, Σ, ν) for ν = 1, 3, 30, 50, 100 and p = 5 and evaluate our
simulation-based approach on each of these datasets. We will assume that µ = (1, 1, 1, 1, 1)0 while
Σ is randomly generated from the Wishart distribution Wp (ν, I p ), where ν = 6. To do so, we can
make use of the following result:
(b) Generating realizations from the Wishart distribution using Bartlett’s decomposition. Bartlett
(1939) provided the following decomposition of a realization from the Wishart distribution Wp (ν, I p ).
Let B√= ((bij )) be the lower triangular matrix of independent random variables with entries
bii = Xi , with Xi ∼ χ2(ν−i+1) , and bij ∼ N (0, 1), for i > j. Then W = BB 0 is a realization
from Wp (ν, I p ). Since for any W ∼ Wp (ν, I p ) implies that T W T 0 ∼ Wp (ν, Σ), where Σ = T T 0 ,
the above provides an easy approach to simulating realizations from the Wishart distribution.
The above provides a practical approach to generating samples from the Wishart distribution.
Once again, you may use the above to write your own R function, or use functions (such as
rwishart or rWishart) from contributed R packages (such as mixAK or bayesm).
For each of the simulated datasets, use the χ2p -test of the book (and class discussion), the practical
simulation-based approach to decide if the dataset is normally distributed or not. Then use the
following function mvnorm.etest from the energy package in R) with the default R = 999 (or higher)
to test, using an alternative approach to deciding multivariate normality. For each n and ν, replicate
the experiment 100 times and report the proportion of times each test is rejected in favor of the
alternative. Summarize the results for the different values of n and ν in a table, and comment. [75
points]
3. Show that the trace of a Wishart random matrix with ν degrees of freedom and parameter matrix σ 2 I
has the χ2 distribution, upto scale, with degrees of freedom given by νp where p is the order of the
matrix. [15 points]
4. Let B be a positive definite matrix and d be a given vector. Show that
(x0 d)2 /x0 Bx ≤ d0 B −1 d
(Hint: Use Cauchy-Schwarz Inequality.) [10 points]
∀ x 6= 0.
Download