Generating Random Matrices BIOS 524 Project Brett Kliner Abigail Robinson Goals of Project • To use simulation to create a random vector X, where X~N(μ, Σ). • To simulate the probability that W >= w, where W is a scalar generated from the X matrix. – W is generated from the mean vector, μ. – W is generated fro the a k x 1 zero vector. Applications • This exercise is mostly academic with uses in matrix algorithms and general linear models. • Hypothesis testing that the mean vector is equal to the zero vector. • This will be useful in Dr. Johnson’s General Linear Models class next semester. The Random X Vector • The X vector (k x 1) will be replicated n times. • X will have a mean vector μ, k x 1. • X will be formed using the covariance matrix Σ, k x k. • The user may specify n, μ and Σ. • The mean vector μ (k x 1) replicated n times gives us an n x k matrix. The Random X Vector • μ and Σ must match on dimension so matrix multiplication can occur. • The covariance matrix must be symmetric, that is Σ = Σ’. • Σ must also be positive definite which means that all of the eigenvalues must be positive. The Random X Vector • Each column of the new n x k matrix will be averaged using PROC MEANS. Mean of each column Standard Deviation 95% Confidence interval on the mean • The n x k matrix will be compared to the Vnormal matrix. The Random X Vector • The call Vnormal function will be used to generate an n x k Vnormal matrix. • PROC Means will be used to analyze each column. Mean of each column Standard Deviation 95% Confidence Interval Computing W • A quadratic form occurs when q = x’Ax. • W is a quadratic form where: W = (x - v)’ -1 (x – v) • v is a k x 1 vector of constants. We will consider two cases of v: v=μ v=0 When v = μ • When v = μ, the distribution of W is considered to be Chi-Square with k degrees of freedom. • The value of w is specified by the user. • The probability that (W>=w) is compared to the call function 1 - ProbChi (w,k). When v = 0 • When v = 0, the distribution of W is considered to be a non-central chi-squared distribution with k degrees of freedom and non-centrality parameter ncp. • Notice that when v = 0, W = x’ -1 x. • ncp is calculated by: • ncp = v’ -1 v where v = μ . When v = 0 • The probability that (W >= w), where W = x’ -1 x, can be compared to the call function 1 – ProbChi (w, k, ncp). The SAS Code • Let’s take a look at the SAS code that accomplishes these tasks. • Please ask questions when they arise.