Happiness is subjective, but that doesn't mean it's impossible to quantify some of the factors that make up happiness. Generally, people are unhappy when they lack means and money, and economic conditions can be linked to certain measures. This enables us to rank countries, roughly, by how miserable their citizens are.
Arguably–or certainly–there's no set formula or prescription for how to be happy, but there are some indicators that point to fairly universal unhappiness. For their annual Misery Index, the CATO Institute takes the sum of a country's inflation, bank lending rates, and unemployment, and divides it by percentage change in GDP. A low figure indicates happiness (and is linked to low inflation, high employment, and growing GDP), while a high figure indicates the opposite.
Perhaps unsurprisingly given the formula, Venezuela takes the dubious honor of being named ‘most miserable' in 2019, primarily due to its frankly surreal 929,790% jump in inflation. Its top-ranking shows, however, the limits of a rigid mathematical formula. Is South Africa (no. 7) significantly more miserable than China (no. 91), or does the CATO institute's simplistic metric ignore all of the softer measures that dictate people's happiness? Ultimately, the misery index just ranks countries' economic stability, without considering their human rights protections, freedoms, or social restrictions.