Signature
r_11 = sqrt(p_11); r_22 = sqrt(p_22); r_12 = p_12 / (r_11 + r_22); r_13 = 1 - r_11 - r_12; r_23 = 1 - r_22
| Inputs | Definition | Unit |
|---|---|---|
p_11 | Diagonal entry of the annual matrix for the first state | probability per year |
p_22 | Diagonal entry of the annual matrix for the second state | probability per year |
p_12 | Includes no one who progressed and then died within the year, who are counted in the annual death entry | probability per year |
r_11 | Unit: probability per six-month cycle | — |
|---|---|---|
r_22 | Unit: probability per six-month cycle | — |
r_12 | Unit: probability per six-month cycle | — |
r_13 | Unit: probability per six-month cycle | — |
r_23 | Unit: probability per six-month cycle | — |
Function
Matrix root of an annual transition matrix for a shorter model cycle
Converts a transition matrix estimated over one interval into the matrix for a cycle n times shorter by taking the n-th root of the whole matrix, so that n short cycles reproduce the original matrix, including movements through intermediate states within the interval. Cohort propagation with a matrix is HE-FM-MM-001, the matrix exponential of a rate matrix HE-CF-CONT-001, competing exits HE-FM-TP-004 and cell-by-cell rescaling of a single probability HE-FM-TP-003. Notation follows the Transition Matrix article.
Computational function
Computational function: n-th root of a transition matrix of any size by eigendecomposition with validity and reproduction checks
Takes the n-th root of a transition matrix of any size by eigendecomposition, P^(1/n) = V D^(1/n) V^-1, and checks the result: whether it is real, whether every entry is non-negative, whether each row sums to one, and how closely its n-th power reproduces the original matrix. It handles structures with recovery or several intermediate states, for which no closed form like HE-FM-TMAT-001 is at hand. The inputs differ from the formula's: a whole matrix and any whole number n.
Inputs and outputs:
P: Square transition matrix with starting states in rows; required, rows summing to 1. Unit: probability per original cycle.;n: Number of shorter cycles in the original cycle, for example 2 for six-month or 12 for monthly cycles from an annual matrix; required. Unit: count.;tol: Numerical tolerance, default 1E-9. Unit: none.;root: Shorter-cycle matrix. Unit: probability per shorter cycle.;real,nonnegative,rows_sum_to_one: Validity checks on the root. Unit: logical.;reproduction_error: Largest absolute difference between the root to the power n and P. Unit: probability.Assumption: P is diagonalisable (for example, distinct eigenvalues) and one shorter-cycle matrix applies throughout the original interval. The function returns the principal root; when any check fails, Chhatwal and colleagues approximate it with the closest stochastic matrix, which this function does not do.
Worked example (Annual matrix of the article to six-month cycles): With P having rows 0.70, 0.20, 0.10; 0, 0.60, 0.40; 0, 0, 1 and n = 2, the root has first row 0.836660, 0.124127 and 0.039213 and second row 0, 0.774597 and 0.225403, real, non-negative and stochastic, with a reproduction error below 1E-15, as in the article.
P = [[0.70, 0.20, 0.10], [0, 0.60, 0.40], [0, 0, 1]]; n = 2; root = [[0.836660, 0.124127, 0.039213], [0, 0.774597, 0.225403], [0, 0, 1]]Worked example (The same matrix to monthly cycles): With n = 12 the monthly matrix has first row 0.970714, 0.024780 and 0.004506 and second row 0, 0.958325 and 0.041675, and twelve monthly cycles return the annual matrix (computed here for illustration).
P = [[0.70, 0.20, 0.10], [0, 0.60, 0.40], [0, 0, 1]]; n = 12; root = [[0.970714, 0.024780, 0.004506], [0, 0.958325, 0.041675], [0, 0, 1]]Worked example (Annual matrix with no valid root): For rows 0.50, 0.50, 0; 0, 0.10, 0.90; 0, 0, 1 the root squared reproduces P, but its first row is 0.707107, 0.488599 and minus 0.195706, so the non-negativity check fails (computed here for illustration).
P = [[0.50, 0.50, 0], [0, 0.10, 0.90], [0, 0, 1]]; n = 2; nonnegative = FALSEExcel: Excel has no eigendecomposition; for a progressive three-state matrix use the closed form of HE-FM-TMAT-001. With any candidate root in a range RootMat, the annual matrix in AnnualMat and a column of ones in OnesCol, the checks below need only MMULT, MIN and MAX.
R:
mat_root <- function(P, n, tol = 1e-9) { e <- eigen(P); R <- e$vectors %*% diag(as.complex(e$values)^(1/n)) %*% solve(e$vectors); real <- all(abs(Im(R)) < tol); R <- Re(R); Rn <- diag(nrow(P)); for (k in seq_len(n)) Rn <- Rn %*% R; list(root = R, real = real, nonnegative = all(R > -tol), rows_sum_to_one = all(abs(rowSums(R)-1) < tol), reproduction_error = max(abs(Rn-P))) }Base R only;mat_root(rbind(c(0.70, 0.20, 0.10), c(0, 0.60, 0.40), c(0, 0, 1)), 2)returns the first example.Python:
def mat_root(P, n, tol=1e-9): P = np.asarray(P, float); w, V = np.linalg.eig(P); R = V @ np.diag(w.astype(complex)**(1/n)) @ np.linalg.inv(V); real = bool(np.all(abs(R.imag) < tol)); R = R.real; return {"root": R, "real": real, "nonnegative": bool(np.all(R > -tol)), "rows_sum_to_one": bool(np.all(abs(R.sum(axis=1)-1) < tol)), "reproduction_error": float(abs(np.linalg.matrix_power(R, n)-P).max())}Needsimport numpy as np; returns the same values as the R function.Test (Root is stochastic and reproduces the annual matrix): Every entry of RootMat is at least 0, RootMat times RootMat returns AnnualMat and each row of RootMat sums to 1. Expected result: TRUE. FALSE shows the cell-by-cell six-month matrix, whose square misses the annual progression entry by about 0.029. Excel check:
=AND(MIN(RootMat)>=0,MAX(ABS(MMULT(RootMat,RootMat)-AnnualMat))<1E-9,MAX(ABS(MMULT(RootMat,OnesCol)-1))<1E-9)Common error (Keeping the real part of a complex root without checking): A root with complex entries is not a transition matrix; dropping the imaginary parts silently gives a matrix that neither reproduces P nor has a clear meaning, so the real flag has to be checked before the root is used.
Source: Chhatwal J, Jayasuriya S, Elbasha EH. Changing cycle lengths in state-transition models: challenges and solutions. Medical Decision Making. 2016;36(8):952-964. doi:10.1177/0272989X16656165 (full text of the author manuscript read). Eigendecomposition approach and approach for non-stochastic matrix roots; Sonnenberg FA, Beck JR. Markov models in medical decision making: a practical guide. Medical Decision Making. 1993;13(4):322-338. doi:10.1177/0272989X9301300409 (full text read). Transition probabilities: the P matrix, with zero probabilities for disallowed transitions.
P = V * D * V^(-1); root = V * D^(1/n) * V^(-1); real = all(Im(root) = 0); nonnegative = all(root >= 0); rows_sum_to_one = all(rowsum(root) = 1); reproduction_error = max(abs(root^n - P))
Try this function
Implementations
Excel
Six-month root of a progressive three-state annual matrix from named cells
With the annual entries in P11, P12 and P22 named, the formulas return the five non-trivial entries of the six-month matrix, held in R11, R22, R12, R13 and R23.
=SQRT(P11); =SQRT(P22); =P12/(R11+R22); =1-R11-R12; =1-R22
Assumptions
Progressive structure with an absorbing death state
The annual matrix has zeros below the diagonal (no return from progressed to progression-free) and death has 1 on its diagonal, so the matrix is upper triangular and the closed form applies; other structures need the general root of HE-CF-TMAT-001.
Same six-month matrix in both halves of the year
The root assumes that one shorter-cycle matrix applies throughout the original interval, so transition risks do not change within the year being split.
Annual matrix with a valid root
p_11 and p_22 are above zero and the result has no negative entry; Chhatwal and colleagues list among the necessary conditions for a valid rate matrix that no transition reachable through other states has a zero entry.
Worked examples
Annual matrix with 70 per cent staying progression-free, 20 per cent progressing and 60 per cent staying progressed
The square roots of 0.70 and 0.60 are 0.836660 and 0.774597, so the six-month progression probability is 0.20 / 1.611257 = 0.124127, death from progression-free is 0.039213 and death from progressed 0.225403; squaring the root returns 0.100000 for annual death from progression-free, as in the article.
p_11 = 0.7; p_22 = 0.6; p_12 = 0.2; r_11 = 0.83666; r_22 = 0.774597; r_12 = 0.124127; r_13 = 0.039213; r_23 = 0.225403
Slower disease with 90 per cent staying progression-free and 6 per cent progressing
With p_11 = 0.90, p_12 = 0.06 and p_22 = 0.80 the six-month progression probability is 0.032554 and death from progression-free 0.018763, and squaring the root returns the annual death probability of 0.04 (computed here for illustration).
p_11 = 0.9; p_22 = 0.8; p_12 = 0.06; r_11 = 0.948683; r_22 = 0.894427; r_12 = 0.032554; r_13 = 0.018763; r_23 = 0.105573
No progression, where the root equals the cell-by-cell conversion
With p_12 = 0 the progression-free row has a single exit to an absorbing state, so the six-month death probability is 1 minus the square root of 0.90, 0.051317, the same as HE-FM-TP-003 gives cell by cell (computed here for illustration).
p_11 = 0.9; p_22 = 0.6; p_12 = 0; r_11 = 0.948683; r_22 = 0.774597; r_12 = 0; r_13 = 0.051317; r_23 = 0.225403
Annual matrix with no direct death from progression-free has no valid root
If half stay progression-free and half progress, with no direct death, while 90 per cent of the progressed die each year, the closed form gives a six-month death probability from progression-free of minus 0.195706, not a valid probability, because death is reachable through the progressed state but has a zero annual entry (computed here for illustration).
p_11 = 0.5; p_22 = 0.1; p_12 = 0.5; r_11 = 0.707107; r_22 = 0.316228; r_12 = 0.488599; r_13 = -0.195706; r_23 = 0.683772
Common errors
Converting each annual probability to six months separately
Applying 1 minus (1 minus p) to the power one half to each cell gives 0.105573 for progression and 0.051317 for death from progression-free; every row still sums to one, but two cycles leave about 711 progression-free, 171 progressed and 118 dead per 1,000 after a year, against 700, 200 and 100 in the evidence, because annual deaths after progression are counted as direct deaths.
Splitting the progression-free exits in proportion to the annual exits
A proportional split under constant competing hazards (HE-FM-TP-004) gets the progression-free entry right but treats the progressed state as absorbing, giving 0.175 progressed and 0.125 dead after one year in the article's example in place of 0.200 and 0.100.
Taking the root once for the mean matrix in a probabilistic analysis
The root is a non-linear function of the matrix and whether it is valid depends on the probability values, so it has to be taken, and checked, for each sampled annual matrix rather than once for the mean.
Sources
Chhatwal and colleagues on the n-th root of an annual matrix
Chhatwal J, Jayasuriya S, Elbasha EH. Changing cycle lengths in state-transition models: challenges and solutions. Medical Decision Making. 2016;36(8):952-964. doi:10.1177/0272989X16656165 (full text of the author manuscript read). Eigendecomposition approach: converting an annual cycle length to a cycle one n-th of a year requires the n-th root of the annual transition probability matrix, P = V D V^-1 and P^(1/n) = V D^(1/n) V^-1; because the example matrix is upper triangular, its eigenvalues are given by the diagonal elements. Issues with the traditional approach: the traditional formula introduced a different Markov chain.
Chhatwal and colleagues on errors from cell-by-cell conversion
Chhatwal J, Jayasuriya S, Elbasha EH. Changing cycle lengths in state-transition models: challenges and solutions. Medical Decision Making. 2016;36(8):952-964. doi:10.1177/0272989X16656165 (full text of the author manuscript read). Background: the traditional approach is relevant to only two-state progressive models. Error with the traditional approach: with the lifetime horizon, the total error in the cumulative incidence of hepatocellular carcinoma, costs and QALYs was minus 42%, minus 19% and 0.9%; the success of the eigendecomposition approach depends not only on the structure of a model but also on the transition probability values.
Chhatwal and colleagues on conditions for a valid root
Chhatwal J, Jayasuriya S, Elbasha EH. Changing cycle lengths in state-transition models: challenges and solutions. Medical Decision Making. 2016;36(8):952-964. doi:10.1177/0272989X16656165 (full text of the author manuscript read). Conditions for the existence of stochastic roots: necessary conditions for embeddability include a positive determinant no greater than the product of the diagonal entries and no states i and j such that j is accessible from i but p_ij = 0; these may also be necessary for the eigendecomposition approach to work. Limitations: not all matrices are diagonalisable, and the root may include complex entries or not be stochastic.
ISPOR-SMDM task force on converting probabilities between time units
Siebert U, Alagoz O, Bayoumi AM, Jahn B, Owens DK, Cohen DJ, Kuntz KM. State-transition modeling: a report of the ISPOR-SMDM Modeling Good Research Practices Task Force-3. Value in Health. 2012;15(6):812-820. doi:10.1016/j.jval.2012.06.014 (full text read). Parameter derivation: the conversion of transition probabilities from one time unit to another should be done through rates.
Jones and colleagues on competing exits within one cycle
Jones E, Epstein D, Garcia-Mochon L. A procedure for deriving formulas to convert transition rates to probabilities for multistate Markov models. Medical Decision Making. 2017;37(7):779-789. doi:10.1177/0272989X17696997 (full text read). Introduction: a person can experience more than one type of event in a single cycle, for example healthy to ill and ill to dead, and the simple formula 1 minus exp(minus rt) is always wrong if there are competing risks.
Canonical Identity
Stable URI · Machine-readable · Resolvable · CC BY 4.0