knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
library(REPS) data("data_constraxion")
The calculate_hedonic_index() function is the central entry point in REPS for computing price indices using various hedonic-based methods. It supports six commonly used approaches:
This vignette demonstrates how to apply each method using a consistent interface, making it easy to compare results across approaches.
The HMTS method implemented in REPS is a multilateral, time-series-based index that balances stability, limited revision, and early detection of turning points in the context of property price indices [@51c4602ed48c4adbb7b7d15176d2da7a].
For broader context and international guidelines on the compilation of property price indices, including traditional methods such as hedonic double imputation Laspeyres, Paasche, Fisher and Repricing, we refer to Eurostat's Handbook on Residential Property Price Indices (RPPIs) [@eurostat2013rppi]. For (Rolling) Time Dummy we refer to Hill et al. [@hill2018repricing; @hill2022rolling].
Before running any calculations, ensure that your dataset is available and contains the necessary variables:
# Example dataset (you should already have this loaded) head(data_constraxion)
The required variables include:
period_variable: the time period dependent_variable: usually price numerical_variables: e.g., floor_area categorical_variables: e.g., neighbourhood_codeTypically, for some numerical variables you may want to apply a log transformation. For example, floor_area is often log-transformed to improve linearity, stabilize variance, and reduce the impact of extreme values. Log-transforming variables can help meet regression assumptions by making relationships between variables more linear and residuals more homoscedastic (constant variance).
Example of log-transforming floor_area:
dataset <- data_constraxion dataset$floor_area <- log(dataset$floor_area)
calculate_hedonic_index()The calculate_hedonic_index() function provides a unified interface for estimating hedonic price indices. You only need to specify the method via the method argument — the function handles the rest.
Supported methods:
"laspeyres": base-period weighted double imputation "paasche": current-period weighted double imputation "fisher": geometric average of Laspeyres and Paasche "hmts": Hedonic Multilateral Time Series with re-estimation and splicing "timedummy": single time-dummy regression (log-linear hedonic model with time factors) "rolling_timedummy": chained index from overlapping time-dummy regressions "repricing": compares observed vs predicted price growth in consecutive periods (quasi-repeat-sales)Tbl_TD <- calculate_hedonic_index( dataset = dataset, method = "timedummy", period_variable = "period", dependent_variable = "price", numerical_variables = c("floor_area", "dist_trainstation"), categorical_variables = c("dummy_large_city", "neighbourhood_code"), reference_period = 2015, number_of_observations = FALSE ) head(Tbl_TD)
multi_result <- calculate_hedonic_index( dataset = dataset, method = c("fisher", "paasche", "laspeyres"), period_variable = "period", dependent_variable = "price", numerical_variables = c("floor_area", "dist_trainstation"), categorical_variables = c("dummy_large_city", "neighbourhood_code"), reference_period = 2015, number_of_observations = FALSE ) head(multi_result$fisher) head(multi_result$paasche) head(multi_result$laspeyres)
For quick and clear visualizations, the plot_price_index() utility function can be used to generate time-series plots of the calculated indices.
While we encourage users to create custom visualizations suited to their analytical needs, this built-in plotting function provides a convenient starting point for simple and consistent line plots.
plot_price_index(multi_result)
knitr::include_graphics("multi_index.png")
The calculate_hedonic_index() function streamlines access to multiple hedonic index methods via a consistent interface. This allows analysts to easily compare outputs and select the most appropriate method for their context.
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.