MARADONER

Statistical tests

General scheme

There are 2 ways to test a hypothesis about a motif in MARADONER:

  1. Through the parameters. Estimates of the motif variance $τ$ and of the mean activity $μ_m$ are asymptotically normal, and their standard errors come from the Fisher information;
  2. Through the predicted activities. The deviations of activity in each group have a posterior distribution with a known covariance matrix. This is also the approach of the original MARA.

The first way answers questions about a motif in general, and the second one compares groups. The tests are listed below.

Question Way Where
Does the activity of a motif vary across samples at all? Parameters tests/asymptotics_based/anova.tsv
Is a motif an activator or a repressor on average? Parameters tests/asymptotics_based/sign.tsv
Do the activities of the motifs of a family change together? Parameters tests/asymptotics_based/family_anova.tsv, for a fit with --motif-families
Does the part of the activities shared by a family differ between groups? Activities tests/prediction_based/family_anova.tsv, see families
Does a motif differ between groups beyond its families? Activities tests/prediction_based/individual_anova.tsv
Does the activity of a motif differ between groups? Activities tests/prediction_based/anova.tsv
Does it differ between the groups of my choice? Activities The anova command
Does a combination of groups, e.g. a difference of 2, differ from zero? Activities The contrast command
Does a covariate have an effect on a motif? Parameters params/covariates, and tests/covariates for a covariate of several levels
Do the effects of 2 covariates differ? Parameters The contrast command with --covariates

The first 4 tables are written by export. All tests need a prior run of predict.

Does a motif vary at all?

A motif of constant activity has a variance $τ$ of zero, so the hypothesis tested is $τ = 0$ against $τ > 0$. The tests/asymptotics_based/anova.tsv table has 2 tests of it:

Columns Test
stat, p-value, FDR A likelihood-ratio test. Zero is on the boundary of the allowed values of a variance, so the p-value is taken from an equal mixture of $χ^2$ distributions with 0 and 1 degrees of freedom. The FDR is that of Benjamini and Hochberg over all motifs of the model
wald_stat, wald_p-value, wald_fdr A one-sided Wald test with the statistic $τ$ over its standard error. It is the older one and has much less power

In the Quickstart example, the likelihood-ratio test finds 366 motifs at an FDR of 0.05, and 1 of them is a motif of constant activity.

With motif families, $τ$ is the variance of the part of a motif not shared with its families. The test then asks whether a motif varies beyond its families, and the families are tested in family_anova.tsv.

The --anova-mode negative option of export reports the opposite tail of the Wald statistic. A small p-value then says that the estimate of $τ$ is unusually close to zero for its standard error. That alone is no evidence that a motif does not vary.

Activator or repressor?

The mean activity of a motif has a sign: positive for a motif whose presence raises the expression on average, negative for one that lowers it. The tests/asymptotics_based/sign.tsv table tests the sign of each motif, the ones left out by predict included:

Columns Meaning
stat The mean activity over its standard error
pvalue_pos, fdr_pos A one-sided test with the alternative of a positive mean
pvalue_neg, fdr_neg A one-sided test with the alternative of a negative mean
zero, fdr_zero The probability of a standard normal variable being closer to zero than stat is. A small value says that the mean is close to zero for its standard error

With a prior on the motif means, the test uses the posterior means and the standard deviations of their prediction error.

In the Quickstart example, 172 motifs get a positive sign and 167 a negative one at an FDR of 0.05. The true means are known there, and every one of the 337 calls made for an active motif has the right sign. The other 2 calls are for motifs with a true mean of zero.

Comparing groups

The tests/prediction_based/anova.tsv table tests whether the activity of a motif is the same in all groups. It is a $χ^2$ test on the predicted deviations and their posterior covariances, with the number of groups minus 1 degrees of freedom. The FDR is that of Benjamini and Yekutieli.

Often only some of the groups are of interest. The anova command runs the same test for the groups listed after the name of the output table:

> maradoner anova MyProject results/anova_1_2_3.tsv group_1 group_2 group_3
	stat	p-value	FDR
motif_1	0.2138217015255737	0.8986057794393304	1.0
motif_2	1.7574175670680292	0.4153188321271469	1.0
inactive_motif_3	1.5194507974656637	0.4677948664373861	1.0

Here, 107 motifs of 440 differ between the 3 groups at an FDR of 0.05. If the table is put into a folder made by export, it gets an entry in the README.md there.

Contrasts

A contrast is a weighted sum of group activities. The simplest one is a difference of 2 groups. The contrast command takes it as an algebraic expression of group names:

> maradoner contrast MyProject "group_2 - group_1" results
> maradoner contrast MyProject "(group_1 + group_2 + group_3) / 3 - group_4" results --postfix first3_vs_4

For each motif, the weighted sum of its activities is divided by the standard deviation of that sum, and the result is tested with a two-sided z-test. The first command writes results/contrast.tsv:

	z_stat	pval	fdr
motif_170	-8.540774231026656	1.3332548119273329e-17	3.9099771677659717e-14
motif_307	-8.038610821576388	9.086266174284185e-16	1.332344461233858e-12
motif_9	7.761655228814863	8.3828033823961e-15	8.194625046870274e-12

The rows shown are the 3 motifs of the largest absolute z_stat. A negative one stands for a motif less active in group_2 than in group_1. The FDR is that of Benjamini and Yekutieli.

The --postfix option of the second command adds a postfix to the name of the table, and the result goes to results/contrast_first3_vs_4.tsv. Without it, each run would overwrite the table of the previous one.

On this page