Discretises a continuous longitudinal variable into ordered classes and estimates a discrete-time, first-order Markov transition probability matrix together with its ergodic (steady-state) distribution. This is the classic distribution-dynamics estimator of Quah (1993): the transition matrix summarises how units move between parts of the distribution from one period to the next, and the steady-state distribution describes where the process settles in the long run.
Input is tidy, long-format panel data with one row per unit-period. The
estimator is agnostic to what the units are (regions, firms, households,
...) and to whether space is involved; spatial conditioning is added by a
companion spatial_markov() function (available in a later release).
Arguments
- data
A data frame in long format with one row per unit and period.
- id
Name (character scalar) of the column identifying the unit.
- time
Name (character scalar) of the column giving the period. Periods are compared in sorted order within each unit.
- value
Name (character scalar) of the numeric column to analyse.
- k
Integer number of classes to discretise
valueinto. Default5(quintiles). Ignored ifbreaksis supplied.- breaks
Optional numeric vector of interior class boundaries. If supplied these fixed cut points are used instead of data-driven quantiles, giving
length(breaks) + 1classes.- fixed
Logical. If
TRUE(default) a single set of quantile breaks is estimated from the pooled distribution and applied to every period (absolute mobility). IfFALSE, breaks are re-estimated within each period (relative mobility). Ignored whenbreaksis supplied.
Value
An object of class sddr_markov: a list with elements
matrixThe
kbykrow-stochastic transition probability matrixP.transitionsThe
kbykmatrix of observed transition counts.steady_stateThe ergodic (stationary) distribution of
P.classesNumber of classes
k.breaksThe class boundaries used (when
fixed).nNumber of units contributing at least one transition.
n_transitionsTotal number of observed transitions.
dataThe input data augmented with the integer
statecolumn.
References
Quah, D. (1993). Empirical cross-section dynamics in economic growth. European Economic Review, 37(2-3), 426-434.
Examples
set.seed(1)
df <- data.frame(
id = rep(1:50, each = 4),
time = rep(2000:2003, times = 50),
value = rnorm(200)
)
m <- markov(df, id = "id", time = "time", value = "value", k = 4)
m
#> <sddr> classic Markov chain
#> units: 50 | transitions: 150 | classes: 4 | breaks: fixed
#>
#> Transition probability matrix (rows = from, cols = to):
#> 1 2 3 4
#> 1 0.225 0.225 0.275 0.275
#> 2 0.229 0.257 0.229 0.286
#> 3 0.306 0.333 0.111 0.250
#> 4 0.205 0.154 0.333 0.308
#>
#> Ergodic (steady-state) distribution:
#> 1 2 3 4
#> 0.240 0.239 0.241 0.281
m$steady_state
#> 1 2 3 4
#> 0.2396739 0.2387903 0.2408205 0.2807152