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)

TimeIndividuallog(Price)Energy Eff.Household Act.Weekendlog(P)×Eff.Private Cust.Building SizeBuilding TypeEnergy Demand
11-0.84230-1.6808.231634.54
21-1.1220-2.208.231454.57
31-0.84220-1.6808.231470.83
41-0.81220-1.6208.231409.56
51-1220-208.231428.04

Forecast Data (first 3 rows)

The forecast file covers future time periods without the Energy Demand target column.

TimeIndividuallog(Price)Energy Eff.Household Act.Weekendlog(P)×Eff.Private Cust.Building SizeBuilding Type
1011-1.34120-1.3418.093
1021-0.67110-0.6718.093
1031-0.66120-0.6618.093

Download sample datasets from GitHub

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*Weekend

Alpha Estimates (Time-Invariant)

VariableEstimateT-statInterpretation
Building Type+99.8063.88Each building type category adds ~100 units of demand
Private Customer+40.3813.29Private customers have ~40 units higher baseline demand
Building Size+32.256.02Larger buildings consume more energy
Intercept+35.000.83Baseline demand level

Beta Estimates (Time-Varying)

VariableEstimateT-statInterpretation
log(Price)-180.2733.31Higher prices significantly reduce energy demand (price elasticity)
Energy Efficiency Programs-101.0024.20Each efficiency program unit reduces demand by ~101 units
Household Activity+50.4419.72Higher household activity increases energy consumption
Weekend+22.787.23Weekend 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.