What does Rent, Buy or Redeem conclude, in numbers, about “Closing the Loop: a Rent-or-Buy Calculator for a Taipei-like and a Kuala-Lumpur-like City, a Pre-Registered Test and Conditions for Refutation”?

Answer: Chapter 8 presents the distilled Rent-or-Buy Comparison Calculator, under whose Kuala-Lumpur-like illustrative parameters the renter leads with probability of only 0.2116, together with a pre-registered test and the conditions that would overturn the book. Marked boxes separate published evidence, runnable Python calculations (20 programs), summaries of classical sources and the author's hypotheses.

Scope of the numbers: Chapter 1 uses user cost to show that in an illustrative city with a rent yield of 0.016 the rent does not even cover the landlord's interest and taxes, and that the verdict is most sensitive to the opportunity cost of funds. Chapter 8 presents the distilled Rent-or-Buy Comparison Calculator, under whose Kuala-Lumpur-like illustrative parameters the renter leads with probability of only 0.2116, together with a pre-registered test and the conditions that would overturn the book.

中文版

Data table

The numbers below are printed verbatim by the chapter's Python program and can be reproduced by running it. standard-library Python onlyprinted values that match the answer: 0.2116, 20

20 yearsTaipei-likeKL-like
w_buy110.02137.49
w_rent168.0974.76
lead58.07-62.73
g_star0.03590.0157
user_cost0.04600.0380
p_rent0.69780.2116
p10-57.66-171.88
median40.29-61.40
p90187.4441.23
g_star: house growth at which buying and renting tie
lead, p10, median, p90: renter minus buyer, Monte Carlo
Show the full program
# Chapter 8. p81: The rent-or-buy calculator on two illustrative cities.
# Model: the ledger of p21, the break-even search of p22, the user cost
# of p11 (k = index-fund return) and the Monte Carlo of p31, run on a
# "Taipei-like" and a "Kuala-Lumpur-like" parameter set. The sets are
# demonstration values chosen to show the mechanics, not estimates of
# either market; taxes and rates are illustrative. 5000 paths, fixed
# seed. distill/tool.py runs the same functions.
import math
import random
import statistics

BASE = {"price": 100.0, "yield": 0.016, "rate": 0.022, "ltv": 0.8,
        "term": 30, "buy_cost": 0.02, "sell_cost": 0.04, "hold": 0.006,
        "g": 0.02, "equity": 0.06}


def annuity(principal, rate, years):
    if rate == 0:
        return principal / years
    return principal * rate / (1.0 - (1.0 + rate) ** -years)


def run_path(p, gh, gs):
    """gh, gs: yearly gross factors of house price and index fund."""
    price = p["price"]
    loan = p["ltv"] * price
    pay = annuity(loan, p["rate"], p["term"])
    bal = loan
    port_b = 0.0
    port_r = (1.0 - p["ltv"] + p["buy_cost"]) * price
    for t in range(len(gh)):
        c_b = math.fsum([pay if t < p["term"] else 0.0,
                         p["hold"] * price])
        c_r = p["yield"] * price
        port_b = (port_b + max(c_r - c_b, 0.0)) * gs[t]
        port_r = (port_r + max(c_b - c_r, 0.0)) * gs[t]
        if t < p["term"]:
            bal = bal * (1.0 + p["rate"]) - pay
        price = price * gh[t]
    w_b = price * (1.0 - p["sell_cost"]) - max(bal, 0.0) + port_b
    return w_b, port_r


def deterministic(p, years):
    return run_path(p, [1.0 + p["g"]] * years, [1.0 + p["equity"]] * years)




VOL = {"hvol": 0.08, "svol": 0.16, "corr": 0.2}


def draw_factors(p, v, rng, years):
    mh = math.log(1.0 + p["g"]) - 0.5 * v["hvol"] ** 2
    ms = math.log(1.0 + p["equity"]) - 0.5 * v["svol"] ** 2
    c = v["corr"]
    s = math.sqrt(1.0 - c * c)
    gh, gs = [], []
    for _ in range(years):
        z1 = rng.gauss(0.0, 1.0)
        z2 = rng.gauss(0.0, 1.0)
        gh.append(math.exp(mh + v["hvol"] * z1))
        gs.append(math.exp(ms + v["svol"] * (c * z1 + s * z2)))
    return gh, gs


def simulate(p, v, n, years):
    rng = random.Random(20261112)
    out = []
    for _ in range(n):
        gh, gs = draw_factors(p, v, rng, years)
        out.append(run_path(p, gh, gs))
    return out


def pct(xs, q):
    xs = sorted(xs)
    return xs[min(len(xs) - 1, int(q * len(xs)))]


CITIES = {
    "Taipei-like": dict(BASE),
    "KL-like": dict(BASE, **{"yield": 0.045, "rate": 0.042, "ltv": 0.9,
                             "buy_cost": 0.04, "sell_cost": 0.03,
                             "hold": 0.008, "g": 0.03}),
}
VOLS = {"Taipei-like": dict(VOL), "KL-like": dict(VOL, hvol=0.07)}


def breakeven(p, years):
    lo, hi = -0.10, 0.20
    for _ in range(60):
        mid = 0.5 * (lo + hi)
        wb, wr = deterministic(dict(p, g=mid), years)
        if wr - wb > 0:
            lo = mid
        else:
            hi = mid
    return 0.5 * (lo + hi)


def report(p, v, years=20, n=5000):
    wb, wr = deterministic(p, years)
    uc = math.fsum([p["equity"], p["hold"], -p["g"]])
    d = [b - a for a, b in simulate(p, v, n, years)]
    return {"w_buy": wb, "w_rent": wr, "lead": wr - wb,
            "g_star": breakeven(p, years), "user_cost": uc,
            "p_rent": len([x for x in d if x > 0]) / len(d),
            "p10": pct(d, 0.1), "median": statistics.median(d),
            "p90": pct(d, 0.9)}


if __name__ == "__main__":
    rows = {c: report(CITIES[c], VOLS[c]) for c in CITIES}
    print("20 years           Taipei-like    KL-like")
    for key in ("w_buy", "w_rent", "lead", "g_star", "user_cost",
                "p_rent", "p10", "median", "p90"):
        a, b = rows["Taipei-like"][key], rows["KL-like"][key]
        small = abs(a) < 1 and abs(b) < 1
        fmt = "{:<12}   {:12.4f} {:12.4f}"
        if not small:
            fmt = "{:<12}   {:12.2f} {:12.2f}"
        print(fmt.format(key, a, b))
    print("g_star: house growth at which buying and renting tie")
    print("lead, p10, median, p90: renter minus buyer, Monte Carlo")

Single source and citation

Fan, Y. (2026). Price-to-Rent Ratios and Holding-Cost NPV, Non-Ergodic Leveraged Home Buying and the Redemption Option in Chinese Dian Tenure (Version 1.0.0), Chapter 8: Closing the Loop: a Rent-or-Buy Calculator for a Taipei-like and a Kuala-Lumpur-like City, a Pre-Registered Test and Conditions for Refutation. 5D Library. DOI pending

DOI pending · monograph page goes live after publication · 5DL-B-219 · v1.0.0 · CC-BY-NC-ND-4.0

BibTeX
@book{fan2026219,
  author    = {Fan, Yafu},
  title     = {Price-to-Rent Ratios and Holding-Cost NPV, Non-Ergodic Leveraged Home Buying and the Redemption Option in Chinese Dian Tenure},
  year      = {2026},
  publisher = {5D Library},
  edition   = {1.0.0},
  note      = {DOI pending}
}

Other chapter answers in this book