liveBook · Manning

State

As explained in Statistics Every Programmer Needs

A state is a distinct condition or status that a process or system can occupy at a particular point in time.

A state is a distinct condition a system can occupy at a given time. In Markov analysis, defining the states is the first step toward forecasting how a system changes. The set must be collectively exhaustive—covering every possible condition—and mutually exclusive, so the system occupies only one state at a time. section 11.2

Once the states are defined, probabilities describe both the present and possible next period:

  • A state-probability vector gives the probability assigned to each state; its entries sum to 1. section 11.2 section 11.3
  • A transition matrix P gives period-to-period conditional probabilities. Entry Pᵢⱼ is the probability of moving from current state i to next state j. section 11.2.2
  • Multiplying the current vector by P produces the next-period vector. Repeating the multiplication forecasts further periods, provided the transition probabilities remain constant. section 11.1 section 11.2.2

Forecast an engine’s condition

Let state 1 mean running and state 2 mean not running. Historical probabilities give P = [[0.90, 0.10], [0.20, 0.80]]: a running engine has a 10% chance of not running the following week, while a non-running engine has a 20% chance of running. If it is running now, multiplying [1, 0] by P gives next week’s probabilities: [0.90, 0.10]. These are probabilities, not a claim that its condition is known in advance. section 11.3

Calculate market-share probabilities in Python

For four carrier states, use NumPy arrays for the current market-share vector and transition matrix: import numpy as np pi0 = np.array([0.40, 0.35, 0.20, 0.05]) P = np.array([[0.85, 0.06, 0.07, 0.02], [0.08, 0.80, 0.10, 0.02], [0.10, 0.10, 0.75, 0.05], [0.12, 0.10, 0.08, 0.70]]) print(np.dot(pi0, P)) # [0.394 0.329 0.217 0.06 ] Here each state is a carrier; the vector entries are shares assigned to those states. Check that the categories account for the market and that the assumed transition probabilities fit the period being forecast. section 11.2 section 11.2.2

The forecast relies on the Markov property: the next state depends on the current state, not the full history. With repeated transitions, a state-probability distribution may reach equilibrium, where its probabilities no longer change. An absorbing state is different: once entered, the system stays there. section 11.1 section 11.3

How Statistics Every Programmer Needs covers it

How deep it goes
Defines exhaustive, exclusive states and works through transition-matrix forecasts, including repeated multiplication and equilibrium.
Examples
Uses running versus non-running engine conditions and four cellular-carrier states, with NumPy market-share forecasts.
What it assumes
Introduces state and transition-matrix definitions before demonstrating vector–matrix multiplication; does not explicitly require prior Markov analysis.
What you can do after
Apply it via NumPy to represent states, multiply a probability vector by a transition matrix, and interpret the forecast.
How it connects
Links states to the Markov property, state-probability vectors, transition matrices, equilibrium distributions, and absorbing states.

Also explained in

Compare how 39 books explain state →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Statistics Every Programmer Needs. The section links point to the parts of the book it draws on.