# testMeanVariance: Test the equality of two normal distributions In SourceSet: A Graphical Model Approach to Identify Primary Genes in Perturbed Biological Pathways

## Description

The function performs the test of equality of two multivariate normal distrbutions (class1 and class2).

## Usage

 `1` ```testMeanVariance(S, S1, S2, n1, n2) ```

## Arguments

 `S` estimated covariance matrix for pooled sample `S1` estimated covariance matrix in class 1 `S2` estimated covariance matrix in class 2 `n1` number of samples in class 1 `n2` number of samples in class 2

## Details

The criterion for testing the equality of two normal distributions is the following:

Λ_c = n_1 * log( |S| / |S^1| ) + n_2 * log( |S| / |S^2| )

The asymptotic null distribution of the criterion, when the maximum likelihood estimates of the covariance matrices are used, is Chi square with |Γ| * (|Γ|+3) / 2 degrees of freedom, where G is the dimension of the underlying distributions.

## Value

The function returns a list that contain the test statistic (`stat`) and the p-value test obtained of equality, using the asymptotic distribution (`alpha`).

## Note

The asymptotic null distributions holds only when the maximum likelihood estimates of the covariance matrices are supplied.

`parameters`

## Examples

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24``` ```if(require(mvtnorm)){ ## Generate two random samples of size 50 from two multivariate normal distributions # sample size n<-50 # true parameters of class 1 and class 2 param.class1<-simulation\$condition1 param.class2<-simulation\$condition2\$`5`\$`2` # simulated dataset data.class1<-rmvnorm(n = n,mean =param.class1\$mu ,sigma =param.class1\$S) data.class2<-rmvnorm(n = n,mean =param.class2\$mu ,sigma=param.class2\$S) data<-rbind(data.class1,data.class2) classes<-c(rep(1,nrow(data.class1)),rep(2,nrow(data.class2))) s<-cov(data) s1<-cov(data.class1) s2<-cov(data.class2) testMeanVariance(S = s,S1 =s1, S2 = s2, n1 = n, n2 = n) ## equivalently... # estimated parameters: maximum likelihood estimate est.param<-parameters(data = data,classes =classes ,shrink = FALSE) testMeanVariance(est.param\$S,est.param\$S1,est.param\$S2,est.param\$n1,est.param\$n2) } ```

SourceSet documentation built on Oct. 30, 2019, 9:38 a.m.