Median Multiple indicator 
The Median Multiple indicator, recommended by the World Bank and the United Nations, rates affordability of housing by dividing the median house price by gross annual median household income.
The standard definition of housing affordability is when housing costs account for no more than 30 percent of household income. Note that some researchers use 35 percent as a measure and others propose a residual income approach that suggests that costs other than housing and utilities, such as child and health care, and transportation be factored into affordability measures.
By the standard measure, many residents of US cities qualify as rent burdened or cost burdened. For example, New York City, more than half of its renters are cost-burdened and may therefore find it difficult to pay for other essentials such as food, clothing and health care.
The problem of being rent burdened is not confined to America's flagship cities, high value housing stock or upscale areas. The problem of high rents that constitute a high percentage of household income is widespread throughout the country's cities.
"In 1990, 41 percent of those living in the lowest–socioeconomic status (SES) neighborhoods were rent burdened, but the highest-SES neighborhoods were not immune. For this study, we focused on the lowest and highest 10 percent of neighborhoods by socioeconomic status and other factors. Between 1990 and 2000, the lowest-SES neighborhoods improved slightly but relapsed significantly in the next decade. By 2010, over half of renters in the lowest-SES neighborhoods and more than a third in the highest-SES neighborhoods were cost burdened (Urban Institute - Rent Burden High in Low- and High-Cost Metros Alike)."
Trulia definition of homeownership affordability
"Affordability is defined as spending 31% or less of one’s monthly income on housing. In order to find the share of affordable homes on the market for the median income earner for each occupation we calculate the maximum amount that each person can allocate towards a mortgage payment based on their wage. Evaluating the listing price of each home effective April 2, 2017 minus a 20% down payment and calculating the monthly mortgage payment using the prevailing 30-year mortgage rate at that time of 4.1% in the markets we examine along with any HOA fees, mortgage insurance and property taxes we sum the number of listed properties that the median income earner for each occupation could afford. - See more at: https://www.trulia.com/blog/trends/affordable-housing/.