API reference

Markov Methods

giddy.markov.Markov(class_ids[, classes, …])

Classic Markov Chain estimation.

giddy.markov.Spatial_Markov(y, w[, k, m, …])

Markov transitions conditioned on the value of the spatial lag.

giddy.markov.LISA_Markov(y, w[, …])

Markov for Local Indicators of Spatial Association

giddy.markov.FullRank_Markov(y[, …])

Full Rank Markov in which ranks are considered as Markov states rather than quantiles or other discretized classes.

giddy.markov.GeoRank_Markov(y[, …])

Geographic Rank Markov.


Kullback information based test of Markov Homogeneity.


Prais conditional mobility measure.


Test for homogeneity of Markov transition probabilities across regimes.

giddy.markov.sojourn_time(p[, summary])

Calculate sojourn time based on a given transition probability matrix.

giddy.ergodic.steady_state(P[, …])

Generalized function for calculating the steady state distribution for a regular or reducible Markov transition matrix P.

giddy.ergodic.fmpt(P[, fill_empty_classes])

Generalized function for calculating first mean passage times for an ergodic or non-ergodic transition probability matrix.


Variances of first mean passage times for an ergodic transition probability matrix.

Directional LISA

giddy.directional.Rose(Y, w[, k])

Rose diagram based inference for directional LISAs.

Economic Mobility Indices

giddy.mobility.markov_mobility(p[, measure, ini])

Markov-based mobility index.

Exchange Mobility Methods

giddy.rank.Theta(y, regime[, permutations])

Regime mobility measure.

giddy.rank.Tau(x, y)

Kendall’s Tau is based on a comparison of the number of pairs of n observations that have concordant ranks between two variables.

giddy.rank.SpatialTau(x, y, w[, permutations])

Spatial version of Kendall’s rank correlation statistic.

giddy.rank.Tau_Local(x, y)

Local version of the classic Tau.

giddy.rank.Tau_Local_Neighbor(x, y, w[, …])

Neighbor set LIMA.

giddy.rank.Tau_Local_Neighborhood(x, y, w[, …])

Neighborhood set LIMA.

giddy.rank.Tau_Regional(x, y, regime[, …])

Inter and intraregional decomposition of the classic Tau.

Alignment-based Sequence Methods

giddy.sequence.Sequence(y[, subs_mat, …])

Pairwise sequence analysis.

Utility Functions

giddy.util.shuffle_matrix(X, ids)

Random permutation of rows and columns of a matrix


Flattens the lower part of an n x n matrix into an n*(n-1)/2 x 1 vector.


Assign 1 to diagonal elements which fall in rows full of 0s to ensure the transition probability matrix is a stochastic one.