Latent Control: Hidden Markov Models

Andrew Fogarty


# load python
# load packages
from h3 import h3
import geopandas as gpd
from shapely import geometry, ops
from shapely.geometry.polygon import Polygon
from shapely.geometry import Point
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from scipy.stats import nbinom
import statsmodels.api as sm
from numba import njit
import matplotlib.colors as mcolors
from import show
from bokeh.plotting import figure
import bokeh.models as bm
from bokeh.models import LinearColorMapper, FixedTicker
from bokeh.palettes import RdBu

1 Introduction

Who controls territory in civil war? This is a central variable in the research and analysis of civil wars – yet it is incredibly difficult to measure. In this post, I model territorial control as a latent variable – an unobserved variable that presumes it is the cause of its indicators. In other words, the data we have is the effect of the latent variable. Latent variables differ from most empirical research in that we often implicitly assume effect indicators; indicators are the effect of the variable being measured. Latent variables are basically the disease-symptom model of phenomena: the disease causes the symptoms, not vice versa.

2 Sample of the Final Output

Upfront, the fruits of latent variable modeling are shown below. I use a Hidden Markov Model to predict territorial control sequences and their predicted probability on a country-wide scale using Uber’s hexagonal spatial indexing.

Bokeh Plot