Energy Electricity Forecasting
Forecast energy demand across regions and building types using panel data with 50 entities tracked over 100 time periods.
Dataset Exploration
The Energy Electricity dataset tracks power consumption metrics across different buildings and time periods. Features include price (log-transformed), energy efficiency programs, household activity levels, and building characteristics.
Panel data structure: 50 entities (buildings/regions) tracked over 100 time periods (5,000 total rows, 11 columns).
Fit Data (first 5 rows)
| Time | Individual | log(Price) | Energy Eff. | Household Act. | Weekend | log(P)×Eff. | Private Cust. | Building Size | Building Type | Energy Demand |
|---|---|---|---|---|---|---|---|---|---|---|
| 1 | 1 | -0.84 | 2 | 3 | 0 | -1.68 | 0 | 8.23 | 1 | 634.54 |
| 2 | 1 | -1.1 | 2 | 2 | 0 | -2.2 | 0 | 8.23 | 1 | 454.57 |
| 3 | 1 | -0.84 | 2 | 2 | 0 | -1.68 | 0 | 8.23 | 1 | 470.83 |
| 4 | 1 | -0.81 | 2 | 2 | 0 | -1.62 | 0 | 8.23 | 1 | 409.56 |
| 5 | 1 | -1 | 2 | 2 | 0 | -2 | 0 | 8.23 | 1 | 428.04 |
Forecast Data (first 3 rows)
The forecast file covers future time periods without the Energy Demand target column.
| Time | Individual | log(Price) | Energy Eff. | Household Act. | Weekend | log(P)×Eff. | Private Cust. | Building Size | Building Type |
|---|---|---|---|---|---|---|---|---|---|
| 101 | 1 | -1.34 | 1 | 2 | 0 | -1.34 | 1 | 8.09 | 3 |
| 102 | 1 | -0.67 | 1 | 1 | 0 | -0.67 | 1 | 8.09 | 3 |
| 103 | 1 | -0.66 | 1 | 2 | 0 | -0.66 | 1 | 8.09 | 3 |
Code Walkthrough
Step 1: Initialize
Python
import pandas as pd
from datfid import DATFIDClient
client = DATFIDClient(token="your_DATFID_token")Step 2: Fit the Model
Python
url_fit = "https://raw.githubusercontent.com/datfid-valeriidashuk/sample-datasets/main/Energy_Electricity.xlsx"
df = pd.read_excel(url_fit)
result = client.fit_model(
df=df,
id_col="Individual",
time_col="Time",
y="Energy Demand",
current_features="all",
filter_by_significance=True
)Step 3: Forecast
Python
url_forecast = "https://raw.githubusercontent.com/datfid-valeriidashuk/sample-datasets/main/Energy_Electricity_forecast.xlsx"
df_forecast = pd.read_excel(url_forecast)
forecast = client.forecast_model(df_forecast=df_forecast)Analysis Results (Model Fit)
Formula
Energy Demand ~ α1*Intercept + α2*Building Size + α3*Private Customer + α4*Building Type + β1*log(Price) + β2*Energy Efficiency Programs + β3*Household Activity + β4*WeekendAlpha Estimates (Time-Invariant)
| Variable | Estimate | T-stat | Interpretation |
|---|---|---|---|
| Intercept | +35.0 | 0.831 | Baseline demand level — not statistically distinguishable from zero on its own (p ≈ 0.41), since building and customer traits absorb most of the level. |
| Building Size | +32.2 | 6.0 | Each additional unit of building size adds ~32.2 to demand. |
| Private Customer | +40.4 | 13.3 | Private customers consume ~40.4 more than the baseline business segment. |
| Building Type | +99.8 | 63.9 | Each step up in building-type index adds ~99.8 to demand — by far the strongest entity-level driver. |
Beta Estimates (Time-Varying)
| Variable | Estimate | T-stat | Interpretation |
|---|---|---|---|
| log(Price) | -180.3 | 33.3 | A 1-unit increase in log price cuts demand by ~180.3 — the headline price-elasticity effect. |
| Energy Efficiency Programs | -101.0 | 24.2 | Each program-step trims demand by ~101.0 — efficiency works as advertised. |
| Household Activity | +50.4 | 19.7 | Each unit of household-activity raises demand by ~50.4. |
| Weekend | +22.8 | 7.2 | Weekend days run ~22.8 above weekdays in average demand. |
Model Performance
0.557
R² Overall
0.897
R² Between
0.305
R² Within
83.8
MAE
10,995.3
MSE
Try it yourself: Run this exact analysis in the Free Playground — select "Energy Electricity" from the sample datasets.