  Statistical thermodynamics has a universal appeal that extends beyond
molecular systems, and yet, as its tools are being transplanted to fields
outside physics, the fundamental question, \textit{what is thermodynamics?},
has remained unanswered. We answer this question here. Generalized statistical
thermodynamics is a variational calculus of probability distributions. It is
independent of physical hypotheses but provides the means to incorporate our
knowledge, assumptions and physical models about a stochastic processes that
gives rise to the probability in question. We derive the familiar calculus of
thermodynamics via a probabilistic argument that makes no reference to physics.
At the heart of the theory is a space of distributions and a special functional
that assigns probabilities to this space. The maximization of this functional
generates the entire mathematical network of thermodynamic relationships. We
obtain statistical mechanics as a special case and make contact with
Information Theory and Bayesian inference.
