From a lineage diagram to a count model
A branching diagram describes a biological hypothesis, but estimation requires a probability model for the observed counts. This tutorial works through a deliberately small, hypothetical example: cells follow a shared trajectory until a split, after which they belong to one of two branches with different expression rates for a gene. The aim is to show how the model links counts to branch assignments and how candidate split points and parameter uncertainty can be examined. The example is simplified; real expression trajectories can change continuously along each branch.
Let \(Y_i\) be the count for a gene in cell \(i\), \(t_i\) its position along an ordered trajectory, and \(\tau\) the split position. Let \(e_i\) be a known exposure, such as a library-size offset on a suitable scale. A latent variable \(Z_i\) records the branch for a post-split cell: \(Z_i=A\) or \(Z_i=B\). Before the split, the model uses a shared rate \(\lambda_0\); after it, the branch-specific rates are \(\lambda_A\) and \(\lambda_B\).
This model assumes that the trajectory positions and exposures are available, the split is represented by a single \(\tau\), and a Poisson distribution is an adequate conditional count model. It also assumes a constant rate within each modeled segment: one shared pre-split rate and one rate per post-split branch. Those assumptions are restrictive, but they make the relationship between the data and the estimates transparent. The earlier material on generative models for tree-structured cell fates and likelihoods for branching trajectories establishes the general latent-branch framework; here the emphasis is on carrying out a complete numerical fit.
For a post-split cell, its marginal count probability is a mixture: \(P(Y_i=y)=\pi f_{\mathrm{Pois}}(y;e_i\lambda_A)+(1-\pi)f_{\mathrm{Pois}}(y;e_i\lambda_B)\). The posterior probability of branch \(B\), sometimes called its responsibility, follows from Bayes' rule:
This is a probability for the cell's branch conditional on the observed count and the current model parameters. It is not the same quantity as the population branch probability \(1-\pi\). A count that is much more likely under branch \(B\) than under branch \(A\) can have a high branch-\(B\) responsibility even when branch \(B\) is less common overall.
Worked Example: Branch Probabilities for Four Simulated Counts
Suppose four hypothetical post-split cells each have exposure \(e_i=1\), and their counts are \(0,1,5,6\). For one EM iteration, start with \(\pi=0.5\), \(\lambda_A=1\), and \(\lambda_B=5\). These are starting values, not fitted conclusions. With equal branch probabilities and equal exposures, the ratio of the branch-\(B\) likelihood to the branch-\(A\) likelihood at count \(y\) is \(5^y e^{-4}\), so \(r_{iB}=R_y/(1+R_y)\).
For \(y=0\), \(R_0=e^{-4}\approx0.01832\), giving \(r_{iB}=0.01832/(1+0.01832)\approx0.0180\). For \(y=1\), \(R_1=5e^{-4}\approx0.09158\), giving \(r_{iB}\approx0.0839\). For \(y=5\), \(R_5=5^5e^{-4}\approx57.24\), giving \(r_{iB}\approx57.24/58.24=0.9828\). For \(y=6\), \(R_6=5^6e^{-4}\approx286.2\), giving \(r_{iB}\approx0.9965\). The corresponding branch-\(A\) probabilities are the complements: approximately \(0.9820, 0.9161, 0.0172,\) and \(0.0035\).
The count of five is about 57 times as likely under the branch-\(B\) rate as under the branch-\(A\) rate, not 286 times as likely; the latter ratio applies here to a count of six. The posterior branch probability is not the likelihood ratio itself: it is the ratio divided by one plus the ratio when the prior probabilities are equal.
Updating the branch probabilities and rates
The expectation-maximization (EM) algorithm alternates between estimating uncertain branch memberships and updating model parameters. At the E-step, compute each post-split cell's responsibility using the current parameters. At the M-step, maximize the expected complete-data log likelihood, treating each cell as fractionally assigned according to its responsibility. For cells with equal exposure \(e_i=1\), the rate update for branch \(k\) is the responsibility-weighted count total divided by the responsibility-weighted cell total.
where \(m\) is the number of post-split cells and \(r_{iA}=1-r_{iB}\). With unequal known exposures, the rate update is \(\lambda_k^{\mathrm{new}}=\sum_i r_{ik}Y_i/\sum_i r_{ik}e_i\). That denominator accounts for the amount of exposure contributing to each branch's counts.
Worked Example: One EM Update for the Simulated Counts
Use the responsibilities just calculated for counts \(0,1,5,6\). Their branch-\(B\) values are approximately \(0.0180,0.0839,0.9828,0.9965\). The weighted count total for branch \(B\) is \(0(0.0180)+1(0.0839)+5(0.9828)+6(0.9965)\approx10.977\). The weighted cell total is \(0.0180+0.0839+0.9828+0.9965\approx2.081\). Thus \(\lambda_B^{\mathrm{new}}\approx10.977/2.081=5.274\) counts per unit exposure.
For branch \(A\), use the complementary responsibilities. Its weighted count total is \(0(0.9820)+1(0.9161)+5(0.0172)+6(0.0035)\approx1.023\), and its weighted cell total is \(0.9820+0.9161+0.0172+0.0035\approx1.919\). Therefore \(\lambda_A^{\mathrm{new}}\approx1.023/1.919=0.5332\) counts per unit exposure. The updated branch-\(B\) probability is \(1-\pi^{\mathrm{new}}\approx2.081/4=0.5203\), with branch-\(A\) probability approximately \(0.4797\).
This is one update, not a claim that the algorithm has converged. A fit would repeat the E- and M-steps until the likelihood or parameter changes met a stated convergence rule, using appropriate starts and checking whether distinct starts reach different solutions. The responsibilities can change as the rates and branch proportion change.
Estimating the split point by profiling
The split point is a model parameter, not a label that can be read directly from a branching diagram. A simple approach is to evaluate a prespecified set of candidate split positions. For each candidate, classify cells before the split as shared-trajectory observations, fit the shared and branch-specific rates under that candidate, and calculate the maximized likelihood. The candidate with the largest profile likelihood is preferred within the candidate set. If branch labels are latent, the mixture likelihood must be used; if labels are observed, the corresponding branch-specific likelihood can be used directly.
The following example uses known hypothetical branch labels to keep the profile calculation explicit. For independent Poisson counts with total count \(Y\) and total exposure \(E\) in a group, the maximum-likelihood rate is \(\widehat{\lambda}=Y/E\). Omitting the factorial terms, which are constant across the split candidates for the same observed cells, that group's maximized log likelihood is \(Y\log(Y/E)-Y\). For \(Y=0\), the term \(Y\log(Y/E)\) is defined as zero.
Worked Example: Comparing Two Candidate Split Positions
Consider four hypothetical pre-branch cells at earlier positions, with total count \(4\) and total exposure \(4\). At position \(t=2\), the two cells have known labels and counts \(1\) on branch \(A\) and \(5\) on branch \(B\); at \(t=3\), the branch-\(A\) and branch-\(B\) counts are \(1\) and \(6\). Each cell has exposure \(1\). Compare a split between \(t=1\) and \(t=2\), denoted candidate \(\tau_1\), with a split between \(t=2\) and \(t=3\), denoted candidate \(\tau_2\).
Under \(\tau_1\), the shared pre-split estimate is \(4/4=1\). The post-split branch totals are \(Y_A=1+1=2\), \(E_A=2\), and \(Y_B=5+6=11\), \(E_B=2\), giving \(\widehat{\lambda}_A=1\) and \(\widehat{\lambda}_B=5.5\). The maximized log-likelihood kernel is \(4\log(1)-4+2\log(1)-2+11\log(5.5)-11\approx1.752\).
Under \(\tau_2\), the two cells at \(t=2\) are treated as shared-trajectory cells. The shared total is \(4+1+5=10\) counts over \(4+2=6\) exposure units, so \(\widehat{\lambda}_0=10/6\approx1.667\). The \(t=3\) branch rates are \(1\) and \(6\). The log-likelihood kernel is \(10\log(10/6)-10+1\log(1)-1+6\log(6)-6\approx-1.141\).
The profile log-likelihood difference is \(1.752-(-1.141)=2.893\). Thus, among these two candidates, \(\tau_1\) has the larger likelihood; the likelihood ratio is \(\exp(2.893)\approx18.06\) in favor of \(\tau_1\). This comparison is not by itself a calibrated hypothesis test or a confidence interval for \(\tau\). In a real fit, the candidate set should be defined in advance or justified, and uncertainty in the split point should be assessed separately.
What the uncertainty statements mean
Parameter uncertainty has more than one source. Even with the split point and branch labels fixed, the rates are estimated from finite counts. In the last example, conditional on \(\tau_1\) and the known labels, the branch-\(A\) estimate is \(2/2=1\) count per exposure unit and the branch-\(B\) estimate is \(11/2=5.5\). A large-sample log-scale approximation gives a standard error for \(\log(\widehat{\lambda})\) of \(1/\sqrt{Y}\), when the Poisson count total is positive. An approximate 95% interval is \(\exp[\log(\widehat{\lambda})\pm1.96/\sqrt{Y}]\).
For branch \(A\), this gives \(\exp[0\pm1.96/\sqrt{2}]\approx[0.250,4.00]\) counts per exposure unit. For branch \(B\), it gives \(\exp[\log(5.5)\pm1.96/\sqrt{11}]\approx[3.05,9.93]\) counts per exposure unit. These are approximate intervals conditional on the selected split and known assignments; with counts this small, the approximation may be rough. They do not account for uncertainty in branch labels or in \(\tau\), which can make overall uncertainty wider.
For latent labels, responsibilities summarize assignment uncertainty under the fitted parameters. For the split point, a profile likelihood across candidate values shows how much support changes with \(\tau\), but choosing a confidence set requires an appropriate calibration. In particular, a split point can be weakly identified when branch-specific rates are similar, few cells lie near the split, or the candidate positions give nearly equal likelihoods. The earlier material on identifiability of branching trajectory models explains why such ambiguity cannot always be resolved by collecting more counts from the same uninformative region.
Diagnostics, alternatives, and limitations
A numerical fit should be examined before its branch assignments are treated as meaningful. Check that estimated rates are finite and nonnegative, that branch proportions lie between zero and one, and that the fitted likelihood is not decreasing across valid EM iterations. Because mixture likelihoods can have local maxima, repeat the fit from multiple initial values. Examine whether responsibilities are nearly all zero or one, whether many are intermediate, and whether the split profile is sharply peaked or nearly flat. Extreme responsibilities are not automatically wrong, but a fit that changes substantially across starting values signals weak identification or optimization difficulty.
The Poisson assumption entails equality of conditional mean and variance. Substantial extra variation, unmodeled library-size differences, or a changing rate within a branch can make the model's assignment probabilities overconfident or its rates misleading. A more flexible count distribution or a time-varying branch trajectory may be needed, but each adds assumptions and parameters. This simple model also treats the supplied trajectory positions and exposure offsets as known; uncertainty in their estimation is not included.
Hard assignment is an alternative: assign every cell to its most probable branch and then estimate rates. It is simple to communicate, but discards uncertainty and can distort estimates when assignments are ambiguous. Soft assignment retains that uncertainty through responsibilities, though it remains conditional on the model and its current parameters. If lineage labels are observed from an independent source, a labeled likelihood can be more direct; if labels are latent, a mixture likelihood is appropriate. Neither approach makes a one-gene, constant-rate model a complete description of cell development. Branch-specific expression association is not evidence that branch identity causes the observed count.
Check Your Understanding
Answer each question, then compare with the solutions below.
- With equal branch probabilities, \(\lambda_A=1\), \(\lambda_B=5\), and exposure one, what is the branch-\(B\) responsibility for a count of zero?
- For counts \(0\) and \(5\) with equal exposures, calculate one branch-\(B\) rate update using responsibilities \(0.0180\) and \(0.9828\).
- Why does a profile likelihood comparison between two split candidates not, by itself, give a 95% confidence interval for the split point?
- If the two branch-specific rates are nearly equal, what happens to the information in the counts about branch assignment?
Solutions. (1) The likelihood ratio is \(R_0=e^{-4}\approx0.01832\). Therefore \(r_B=R_0/(1+R_0)\approx0.0180\). (2) The weighted count total is \(0(0.0180)+5(0.9828)=4.914\), and the weighted cell total is \(0.0180+0.9828=1.0008\). The update is \(4.914/1.0008\approx4.910\) counts per exposure unit. (3) The likelihood comparison ranks the fitted candidates, but interval coverage requires a calibrated cutoff that accounts for the sampling distribution and the split-point search; the comparison alone supplies neither. (4) When the rates are nearly equal, the two branch likelihoods for a count are similar, so the count contributes little to distinguishing the branches and responsibilities tend to remain close to their prior branch probabilities.