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*Building Type + α4*Private Customer + β1*log(Price) + β2*Energy Efficiency Programs + β3*Household Activity + β4*WeekendAlpha Estimates (Time-Invariant)
| Variable | Estimate | T-stat | Interpretation |
|---|---|---|---|
| Building Type | +99.80 | 63.88 | Each building type category adds ~100 units of demand |
| Private Customer | +40.38 | 13.29 | Private customers have ~40 units higher baseline demand |
| Building Size | +32.25 | 6.02 | Larger buildings consume more energy |
| Intercept | +35.00 | 0.83 | Baseline demand level |
Beta Estimates (Time-Varying)
| Variable | Estimate | T-stat | Interpretation |
|---|---|---|---|
| log(Price) | -180.27 | 33.31 | Higher prices significantly reduce energy demand (price elasticity) |
| Energy Efficiency Programs | -101.00 | 24.20 | Each efficiency program unit reduces demand by ~101 units |
| Household Activity | +50.44 | 19.72 | Higher household activity increases energy consumption |
| Weekend | +22.78 | 7.23 | Weekend days have ~23 units higher demand |
Model Performance
0.557
R² Overall
0.897
R² Between
0.305
R² Within
83.83
MAE
10,995
MSE
Try it yourself: Run this exact analysis in the Free Playground — select "Energy Electricity" from the sample datasets.