File:CzechResidentialRePrice.svg

From Wikiversity
Jump to navigation Jump to search

Original file(SVG file, nominally 768 × 432 pixels, file size: 79 KB)

This is a file from the Wikimedia Commons. The description on its description page there is shown below.

Commons is a freely licensed media file repository. You can help.

Summary

Description
English: Czech residential real estate price, plotted using Python code from Plotting code section.
Date
Source Own work
Author Dan Polansky

Licensing

I, the copyright holder of this work, hereby publish it under the following license:
w:en:Creative Commons
attribution
This file is licensed under the Creative Commons Attribution 4.0 International license.
You are free:
  • to share – to copy, distribute and transmit the work
  • to remix – to adapt the work
Under the following conditions:
  • attribution – You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.

Plotting code

from matplotlib import pyplot as plt
import datetime
plotPrices = True
plot5YRates = True
# Data source: https://fred.stlouisfed.org/series/QCZN628BIS
# Residential Property Prices for Czech Republic, Index 2010=100, Quarterly, Not Seasonally Adjusted
inputDataFred = [
  "2008-01-01:102.074",
  "2008-04-01:106.2746",
  "2008-07-01:107.8498",
  "2008-10-01:107.2197",
  "2009-01-01:104.9094",
  "2009-04-01:101.549",
  "2009-07-01:100.7088",
  "2009-10-01:99.9737",
  "2010-01-01:99.9737",
  "2010-04-01:100.1838",
  "2010-07-01:99.8687",
  "2010-10-01:99.9737",
  "2011-01-01:100.1838",
  "2011-04-01:100.7088",
  "2011-07-01:100.0788",
  "2011-10-01:99.1336",
  "2012-01-01:98.6086",
  "2012-04-01:98.7136",
  "2012-07-01:98.5035",
  "2012-10-01:98.3985",
  "2013-01-01:98.2935",
  "2013-04-01:98.8186",
  "2013-07-01:98.7136",
  "2013-10-01:98.5035",
  "2014-01-01:99.7637",
  "2014-04-01:100.6038",
  "2014-07-01:101.4439",
  "2014-10-01:102.179",
  "2015-01-01:103.2292",
  "2015-04-01:104.3844",
  "2015-07-01:105.6445",
  "2015-10-01:106.7997",
  "2016-01-01:108.1649",
  "2016-04-01:110.3702",
  "2016-07-01:113.1006",
  "2016-10-01:118.4563",
  "2017-01-01:122.0268",
  "2017-04-01:125.0722",
  "2017-07-01:127.2775",
  "2017-10-01:128.4327",
  "2018-01-01:131.268",
  "2018-04-01:135.1536",
  "2018-07-01:138.514",
  "2018-10-01:141.1394",
  "2019-01-01:144.0798",
  "2019-04-01:147.6503",
  "2019-07-01:150.5907",
  "2019-10-01:153.7411",
  "2020-01-01:156.4715",
  "2020-04-01:159.0969",
  "2020-07-01:163.1924",
  "2020-10-01:167.498",
  "2021-01-01:177.3694",
  "2021-04-01:186.5056",
  "2021-07-01:199.3174",
  "2021-10-01:210.659",
  "2022-01-01:220.8454",
  "2022-04-01:228.0914",
  "2022-07-01:230.4017",
  "2022-10-01:225.256",
  "2023-01-01:222.4206",
  "2023-04-01:221.8955",
  "2023-07-01:222.3156"]

# From https://vdb.czso.cz/
# For reference and is not used.
czsoData = {2006: 109, # 2005 index
            2007: 128.9,
            2008: 144.9,
            2009: 138.1}

# Apartment prices, from https://www.cnb.cz/export/sites/cnb/cs/financni-stabilita/.galleries/zpravy_fs/fs_2010-2011/fs_2010-2011_kap_3_2.xls
# For reference only; not used
cnbApartmentData = [
  "31.3.1999:100.0",
  "30.6.1999:101.1",
  "30.9.1999:102.3",
  "31.12.1999:105.9",
  "31.3.2000:110.4",
  "30.6.2000:112.2",
  "30.9.2000:110.8",
  "31.12.2000:114.9",
  "31.3.2001:118.9",
  "30.6.2001:125.9",
  "30.9.2001:129.9",
  "31.12.2001:139.8",
  "31.3.2002:148.6",
  "30.6.2002:155.8",
  "30.9.2002:157.5",
  "31.12.2002:164.8",
  "31.3.2003:177.5",
  "30.6.2003:190.9",
  "30.9.2003:192.7",
  "31.12.2003:185.8",
  "31.3.2004:184.3",
  "30.6.2004:182.5",
  "30.9.2004:180.7",
  "31.12.2004:180.9",
  "31.3.2005:181.8",
  "30.6.2005:182.7",
  "30.9.2005:183.6",
  "31.12.2005:185.8",
  "31.3.2006:189.8",
  "30.6.2006:194.6",
  "30.9.2006:198.7",
  "31.12.2006:212.0",
  "31.3.2007:237.9",
  "30.6.2007:258.3",
  "30.9.2007:268.7",
  "31.12.2007:278.4",
  "31.3.2008:292.4",
  "30.6.2008:308.5",
  "30.9.2008:313.7",
  "31.12.2008:306.9",
  "31.3.2009:288.5",
  "30.6.2009:265.4",
  "30.9.2009:260.5",
  "31.12.2009:258.3",
  "31.3.2010:257.3",
  "30.6.2010:257.2",
  "30.9.2010:255.6",
  "31.12.2010:253.4",
  "31.3.2011:248.9"]

# Real estate prices, from https://www.cnb.cz/export/sites/cnb/cs/financni-stabilita/.galleries/zpravy_fs/fs_2010-2011/fs_2010-2011_kap_3_2.xls
# Question: are commercial RE prices included? Nothing in the XLS says otherwise.
cnbRealEstateData = [
  "31.3.1999:100.0", 
  "30.6.1999:103.0", 
  "30.9.1999:106.4", 
  "31.12.1999:110.8", 
  "31.3.2000:112.8", 
  "30.6.2000:115.4", 
  "30.9.2000:117.6", 
  "31.12.2000:120.8", 
  "31.3.2001:123.7", 
  "30.6.2001:127.8", 
  "30.9.2001:133.4", 
  "31.12.2001:139.9", 
  "31.3.2002:146.0", 
  "30.6.2002:149.5", 
  "30.9.2002:151.1", 
  "31.12.2002:153.7", 
  "31.3.2003:159.1", 
  "30.6.2003:165.4", 
  "30.9.2003:166.6", 
  "31.12.2003:163.8", 
  "31.3.2004:164.9", 
  "30.6.2004:165.6", 
  "30.9.2004:166.8", 
  "31.12.2004:167.0", 
  "31.3.2005:168.0", 
  "30.6.2005:170.1", 
  "30.9.2005:173.0", 
  "31.12.2005:176.8", 
  "31.3.2006:180.9", 
  "30.6.2006:185.0", 
  "30.9.2006:188.6", 
  "31.12.2006:195.3", 
  "31.3.2007:207.9", 
  "30.6.2007:219.1", 
  "30.9.2007:225.6", 
  "31.12.2007:231.1", 
  "31.3.2008:238.3", 
  "30.6.2008:248.3", 
  "30.9.2008:253.3", 
  "31.12.2008:251.7", 
  "31.3.2009:244.5", 
  "30.6.2009:234.9", 
  "30.9.2009:232.5", 
  "31.12.2009:231.6"]
  
dates = []
prices = []
calc5YRates = []
for dataRowStr in inputDataFred:
  dataRow = dataRowStr.split(":")
  date = datetime.datetime.strptime(dataRow[0], "%Y-%m-%d").date()
  price = float(dataRow[1])
  dates.append(date)
  prices.append(price)
  qInY = 4 # Quarter count in year
  if len(prices) > 5 * qInY:
    calc5YRates.append((float(prices[-1]) / prices[-1 - 5 * qInY]) ** (1/5.0))
  else:
    calc5YRates.append(float("nan"))

cnbIndexValues = []
cnbDates = []
for dataRowStr in cnbRealEstateData:
  dataRow = dataRowStr.split(":")
  date = datetime.datetime.strptime(dataRow[0], "%d.%m.%Y").date()
  cnbIndexValue = float(dataRow[1]) * 0.4
  cnbDates.append(date)
  cnbIndexValues.append(cnbIndexValue)

datesUnited = sorted(set(dates) | set(cnbDates))

if plotPrices:
  fig, biax = plt.subplots()
  figSize = fig.get_size_inches()
  fig.set_size_inches(figSize[0] * 4/3, figSize[1])
  biax.set(xlabel="Date (label on 1 january)", ylabel="Index 1: 1999=40 points\nIndex 2: 2010=100 points", # 40 points match the 0.4 above.
           title="Czech (residential) real estate prices, index, quarterly step (per CNB and stlouisfed.org)\n"+
                 "Series 1: RE prices from CNB; series 2: residential RE prices from stlouisfed.org\n" +
                 "Disclaimer: the visual juxtaposition of the two series may be misleading")
  xtickDates, xtickDatesStr = [], []
  for year in range(1999, 2023+1):
    date = datetime.datetime.strptime(str(year) + "-01-01", "%Y-%m-%d").date()
    xtickDates.append(date)
    xtickDatesStr.append(str(year))
  plt.ylim(0, 240)
  plt.yticks([x * 20 for x in range(0, 13)])
  plt.plot(dates, prices, color="#6699CC")
  plt.plot(cnbDates, cnbIndexValues, color="#99CC66")
  plt.xticks(xtickDates, xtickDatesStr, rotation=70)
  plt.grid(linewidth=0.25, color="#CCCCCC")
  plt.tight_layout()
  plt.savefig("CzechResidentialRePrice.svg")
  
if plot5YRates: # Issue: there are not enough years for this to make sense
  fig, biax = plt.subplots()
  figSize = fig.get_size_inches()
  fig.set_size_inches(figSize[0] * 4/3, figSize[1])
  biax.set(xlabel="Withdrawal date (label on 1 January)", ylabel="Index change rate",
           title="5-year change rate of Czech residential real estate, annualized (base data per stlouisfed.org)\n" +
                 "The date of withdrawal, the date of deposit being 5 years before")
  xtickDates, xtickDatesStr = [], []
  for idx, date in enumerate(dates):
    if date.month == 1 and date.day == 1:
      xtickDates.append(date)
      xtickDatesStr.append(str(date.year))
  plt.xticks(xtickDates, xtickDatesStr, rotation=70)
  plt.axhline(1, color='#BBBBBB', linewidth=0.75)
  plt.plot(dates, calc5YRates, color="#6699CC")
  plt.grid(linewidth=0.25, color="#CCCCCC")
  biax.set_yticklabels(['{:,.1%}'.format(x - 1) for x in biax.get_yticks()])
  plt.tight_layout()
  plt.savefig("CzechResidentialRePrice5YYield.svg")

Captions

Czech residential real estate price

Items portrayed in this file

depicts

11 April 2024

image/svg+xml

8f2c371d58171b290548a5ae698a6807741b66a0

81,207 byte

432 pixel

768 pixel

File history

Click on a date/time to view the file as it appeared at that time.

Date/TimeThumbnailDimensionsUserComment
current09:59, 12 April 2024Thumbnail for version as of 09:59, 12 April 2024768 × 432 (79 KB)Dan PolanskyExpand.
14:54, 11 April 2024Thumbnail for version as of 14:54, 11 April 2024768 × 432 (56 KB)Dan PolanskyUploaded own work with UploadWizard

The following page uses this file:

Metadata