How we calculate appreciation?
The logic for year-over-year appreciation when data is incomplete:
For individual properties:
It calculates changes between consecutive available data points chronologically
If years are missing, it calculates across the gap and adjusts the time period accordingly
The time_diff_years field indicates the actual time between measurements (could be >1 year)
It never interpolates or estimates missing years
For zipcode analysis:
Properties are grouped based on their purchase/sale span (first date to last date)
A property is counted in every year between its first and last transaction
For each year, it only includes properties that were "active" during that year
The annualized appreciation rate normalizes appreciation over different time periods
It provides median/average appreciation metrics for each year based on available properties
This approach means the data represents what was happening with properties that spanned each particular year rather than strict year-to-year changes across the same set of properties.
Simple example:
Property A:
2010: Purchased for $100,000
2015: Sold for $150,000
The code calculates:
Total appreciation: $50,000 (50%)
Time period: 5 years
Annualized appreciation: 8.45% per year ((150000/100000)^(1/5)-1)
100
For zipcode analysis:
Property A contributes its 8.45% annualized rate to years 2010-2015
If no other properties sold in 2012, the analysis still includes Property A's performance for 2012
If Property B sold in 2012 and 2014 with 10% annualized rate, then 2012's zipcode appreciation would average both properties (≈9.23%)
The system doesn't estimate missing prices between transactions - it calculates the compound annual growth rate over the actual transaction period and applies it to each year in that span.