Regression Diagnostics by Period using REPS"

knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)
library(REPS)
data("data_constraxion")

Introduction

The calculate_regression_diagnostics() function in REPS provides regression diagnostics by period. It is designed for panel or repeated cross-section data (e.g. property transactions over time) to evaluate the quality of period-specific log-linear regressions.

For each period, it:

These diagnostics help assess model quality over time, identifying periods with issues like non-normality, low fit, heteroscedasticity, or autocorrelation.

Required Data

Your dataset should include:

# Example dataset (you should already have this loaded)
head(data_constraxion)

# We log transform the floor_area again (see vignette on calculating price index as why)
dataset <- data_constraxion
dataset$floor_area <- log(dataset$floor_area)

Using calculate_regression_diagnostics()

Example:

diagnostics <- calculate_regression_diagnostics(
  dataset = dataset,
  period_variable = "period",
  dependent_variable = "price",
  numerical_variables = c("floor_area", "dist_trainstation"),
  categorical_variables = c("dummy_large_city", "neighbourhood_code")
)

head(diagnostics)

Visualizing Diagnostics

For convenient visualization:

plot_regression_diagnostics(diagnostics)

This generates a 3x2 grid of plots:

Example:

knitr::include_graphics("diagnostics_plot.png")

Interpreting the Output

The hedonic price index relies on a log-linear regression model, which assumes that certain statistical conditions hold. The diagnostics plot provides an overview of how well these assumptions are met across different periods.

Each subplot corresponds to a specific model assumption:

Row 1: Normality and Linearity

Row 2: Independence

Row 3: Homoscedasticity

Summary

The calculate_regression_diagnostics() and plot_regression_diagnostics() functions in REPS enable:

They support robust, high-quality hedonic price index modeling by systematically checking regression assumptions.



Try the REPS package in your browser

Any scripts or data that you put into this service are public.

REPS documentation built on March 16, 2026, 5:08 p.m.