Parameters estimation
Fitting model to data
The parameters of the model are estimated with the fit command. Briefly, if we denote the expression table as $Y$ and the loading matrix as $B$, MARADONER models the expression as
$$Y = μ_p 1_s^T + 1_p μ_s^T + B U + E.$$
Here, $μ_p$ and $μ_s$ are promoter-wise and sample-wise means, $U$ is a matrix of motif activities and $E$ is noise. The activities are random. For motif $k$ in a sample of group $g$,
$$U_{k} \,~\, N(μ_{m,k},\: τ_k ν_g),\: E \,~\, N(0,\: σ_g).$$
So each motif has a mean activity $μ_m$ and a variance $τ$, and each group of samples has an error variance $σ$ and a multiplier of activity variances $ν$. These are the parameters to be estimated. The activities are dealt with later by the predict command.
The command requires only the project name:
> maradoner fit MyProject
After a successful fit run, a *.fit file should appear in the current working directory. Files of the later steps left from a previous fit of the same project are removed.
The parameters are estimated one kind after another, and each stage reports itself as it starts:
| Stage | Parameters | Method |
|---|---|---|
| Error variances | $σ$ of each group | Restricted maximum likelihood (REML) on the part of the data orthogonal to the loadings |
| Promoter-wise means | $μ_p$ | Maximum likelihood, the solution of the minimal norm |
| Variances of motif activities | $τ$ of each motif, $ν$ of each group | REML on the data with all means projected out |
| Motif means | $μ_m$ | Generalized least squares |
| Sample means | $μ_s$ | Generalized least squares |
The reasoning behind this order is explained in the How it works section. The output of a run is discussed in the Quickstart.
Warnings
The fit command checks whether the data are enough to estimate what was asked for. The warnings below are the most common ones.
| Warning | Meaning | Remedy |
|---|---|---|
| The error variances of the sample groups are not identifiable | There are more groups than the samples can support. That happens when every sample forms a separate group and samples are few | Fewer and larger groups (--sample-groups of create), or more samples |
| Variances of motif activities were estimated as zero | The data carry little signal about most motifs. With the default settings, predict leaves such motifs out |
Fewer motifs, clustering or --no-motif-variance |
| The Fisher information for (tau, nu) is singular | Some variances can't be told apart. A common cause is collinear motifs, i.e. a loading matrix of a rank lower than the number of motifs. Standard errors of the variances and the tests built on them are unreliable | Removing duplicated motifs, or clustering |
| The variance of motif activities of a sample group was estimated as zero | The activities of the group are shrunk to the motif means, and its tests are uninformative. The group may be too small or too noisy | Merging the group with a similar one |
Variance structure
By default, each motif has a variance and each group has an error variance and a multiplier. The options below change that.
| Name | Description | Default value |
|---|---|---|
--no-motif-variance |
One variance for all motifs. This makes the model closer to the classic (IS)MARA and might be beneficial when the data is small | --motif-variance |
--error-lowrank <int> |
Rank $k$ of a low-rank correction to the covariance of the noise across samples: it becomes $D + W W^T$ with $W$ of $s$ rows and $k$ columns. Captures correlated structure of samples missed by the diagonal $D$, e.g. a batch or an unmodeled covariate. Must be smaller than the number of samples minus 1 | 0 |
--activity-lowrank <int> |
Rank $k$ of a low-rank correction to the covariance of the activities across samples: it becomes $G + V V^T$, with $G$ being a diagonal matrix of $ν$. Captures hidden factors of samples along which motif activities change together, as explained in the Hidden covariates section. The rank is chosen with the select-rank command. Requires motif variances |
0 |
--motif-families <path> |
A file of motif families. The activities of the motifs of a family get a common part with a variance $ω$ per family, and the covariance between motifs becomes $Σ + F Ω F^T$. Requires motif variances | |
--motif-lowrank <int> |
Rank $k$ of a covariance between families: $Ω$ becomes $Ω + L L^T$. Without --motif-families the covariance between motifs becomes $Σ + L L^T$ |
0 |
--promoter-variance |
(Experimental) Promoters are reweighted by a heuristic estimate of their individual error variances | Disabled |
--promoter-variance option does a different thing at the moment, namely a mixture-based reweighting of promoters. The weights define no likelihood, so the likelihood-ratio test of the ANOVA is replaced with a Wald test for such fits.
The low-rank corrections and the families enter the estimation of the motif means and their standard errors as well.
Clustering
Motifs with similar loadings are hard to tell apart, and with more motifs than promoters the model can't be estimated at all. In those cases the motifs can be replaced with clusters:
> maradoner fit MyProject --clustering KMeans --num-clusters 100
Here, KMeans puts each motif into exactly one cluster. The alternative is NMF, a non-negative matrix factorization: a motif may then belong to several clusters, and the loadings must be non-negative. The number of clusters is 200 by default.
All the later commands then work with clusters in place of motifs, and the clusters are named cluster_1, cluster_2 and so on. At the moment, the composition of clusters is not among the exported tables.
Held-out promoters
A part of promoters can be kept out of the fit as a testing set, either by chromosome or by name:
> maradoner fit MyProject --test-chromosomes 3 --test-chromosomes X > maradoner fit MyProject --test-promoters-filename names.txt
The first form needs promoter names that contain a chromosome, e.g. chr3:1000-2000. The second one takes a text file with one promoter name per line. What to do with the testing set next is explained in the Goodness of fit section.
Motif means
With many motifs for the number of promoters, the mean activities fit the levels of the training promoters too closely. The --motif-mean-prior option shrinks them with a prior, and its variances are estimated by REML:
> maradoner fit MyProject --motif-mean-prior covariance
Here, covariance is one of the kinds of the prior. The others are ridge, families and none, the default. They are compared in Regularization of motif means.
Other options
| Name | Description | Default value |
|---|---|---|
--gpu |
Use a GPU, if available, for most of the computations | Disabled |
--gpu-decomposition |
Use a GPU, if available, for the SVD of the loading matrix | Disabled |
--no-x64 |
Disables double precision algebra | --x64 |
The number of CPU threads is a global option of MARADONER and is discussed in the F.A.Q.
