calculate_regression_diagnostics: Calculate regression diagnostics by period

View source: R/calculate_regression_diagnostics.R

calculate_regression_diagnosticsR Documentation

Calculate regression diagnostics by period

Description

For each period in the data, fits a log-linear model and computes diagnostics:

  • Normality test (Shapiro-Wilk)

  • Adjusted R-squared

  • Breusch-Pagan test for heteroscedasticity

  • Durbin-Watson test for autocorrelation

Usage

calculate_regression_diagnostics(
  dataset,
  period_variable,
  dependent_variable,
  numerical_variables = NULL,
  categorical_variables = NULL
)

Arguments

dataset

A data.frame with input data

period_variable

Name of the period variable (string)

dependent_variable

Name of the dependent variable (string)

numerical_variables

Vector of numerical independent variables (default = NULL)

categorical_variables

Vector of categorical independent variables (default = NULL)

Value

A data.frame with diagnostics by period

Author(s)

Mohammad Kardal, Vivek Gajadhar

Examples

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

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