library(dplyr)
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
library("readxl")
# xlsx files
generation_price_data <- read_excel("/Users/josemawyin/Library/Mobile Documents/com~apple~CloudDocs/Data Science Masters /606/Project Proposal/2013_Generation_Price_Energy.xlsx")
multiplot <- function(..., plotlist=NULL, file, cols=1, layout=NULL) {
library(grid)
# Make a list from the ... arguments and plotlist
plots <- c(list(...), plotlist)
numPlots = length(plots)
# If layout is NULL, then use 'cols' to determine layout
if (is.null(layout)) {
# Make the panel
# ncol: Number of columns of plots
# nrow: Number of rows needed, calculated from # of cols
layout <- matrix(seq(1, cols * ceiling(numPlots/cols)),
ncol = cols, nrow = ceiling(numPlots/cols))
}
if (numPlots==1) {
print(plots[[1]])
} else {
# Set up the page
grid.newpage()
pushViewport(viewport(layout = grid.layout(nrow(layout), ncol(layout))))
# Make each plot, in the correct location
for (i in 1:numPlots) {
# Get the i,j matrix positions of the regions that contain this subplot
matchidx <- as.data.frame(which(layout == i, arr.ind = TRUE))
print(plots[[i]], vp = viewport(layout.pos.row = matchidx$row,
layout.pos.col = matchidx$col))
}
}
}
head(generation_price_data)
Energy markets were designed with the goal to trade energy produced by traditional energy generators such as coal, gas and nuclear plants. These generators are responsive to the forecasted future energy demand. This means that the energy generation at any moment can be controlled to meet the energy demand of a region. Under such conditions, the pricing of energy can be done in an environment of known expectations. However, energy generation from renewable sources such as Wind or Solar Energy depend on changing local conditions that cannot be controlled such as weather. Also, reneawble energy is generated at its full potential. For example, a wind turbine cannot be set a 50% generation like a coal station could be.
Renewable energy generation adds uncertainty in the energy market and therefore causes uncertainty in the price of energy. This study wants to study how renewable energy generation, in this case Wind Energy, affected the price of energy in the United Kingdom in the year 2013.
We have data at the half and hour interval for the whole year of 2013 showing the generation from “Coal”, “CCGT”, “Nuclear”, “Wind”, as well as the price of buying and selling energy during the same period.
The Data in this study was collected by:
Balancing Mechanism Reporting Service (BMRS): This BMRS is the primary channel for providing operational data relating to the GB Electricity Balancing and Settlement arrangements. It is used extensively by market participants to help make trading decisions and understanding market dynamics and acts as a prompt reporting platform as well as a means of accessing historic data.
ELEXON: ELEXON compares how much electricity generators and suppliers say they will produce or consume with actual volumes. We work out a price for the difference and transfer funds. This involves taking 1.25 million meter readings every day and handling £1.5 billion of our customers’ funds each year.
This is an obervational study of the relationship between energy generation and pricing of energy.
Data collected by ELEXON and BM Reports is available here: *https://www.bmreports.com/bmrs/?q=help/about-us*
The dependent variable is the half-hourly energy price and is numerical.
The dependent variable is the half-hourly generation of Wind Energy and is numerical.
The plots below show how as the wind generation increases, the sell price of energy is affected. This study will analyze in more detail this relationship.
SD.Wind <- sd(generation_price_data$Wind)
Mean.Wind <- mean(generation_price_data$Wind)
One.SD.High.Wind <- 1*SD.Wind + Mean.Wind
Two.SD.High.Wind <- 2*SD.Wind + Mean.Wind
Three.SD.High.Wind <- 3*SD.Wind + Mean.Wind
Four.SD.High.Wind <- 4*SD.Wind + Mean.Wind
One.SD.High.Wind.Data <- filter(generation_price_data, generation_price_data$Wind > One.SD.High.Wind)
Two.SD.High.Wind.Data <- filter(generation_price_data, generation_price_data$Wind > Two.SD.High.Wind)
Three.SD.High.Wind.Data <- filter(generation_price_data, generation_price_data$Wind > Three.SD.High.Wind)
Four.SD.High.Wind.Data <- filter(generation_price_data, generation_price_data$Wind > Four.SD.High.Wind)
library(ggplot2)
p1 <- ggplot(generation_price_data, aes(x=Sell)) +
geom_histogram(color="black", fill="white") + geom_vline(aes(xintercept=mean(Sell)),
color="blue", linetype="dashed", size=1) +
geom_histogram(aes(y=..density..), colour="black", fill="white")+
geom_density(alpha=.2, fill="#FF6666") +
labs(title="All Wind Generation",x="Sell Price(British Pounds)", y = "Count")+
theme_classic() + xlim(0, 100)
p2 <- ggplot(One.SD.High.Wind.Data, aes(x=Sell)) +
geom_histogram(color="black", fill="white") + geom_vline(aes(xintercept=mean(Sell)),
color="blue", linetype="dashed", size=1) +
geom_histogram(aes(y=..density..), colour="black", fill="white")+
geom_density(alpha=.2, fill="#FF6666") +
labs(title="Wind Generation at (Mean + 1 S.D.)",x="Sell Price(British Pounds)", y = "Count")+
theme_classic() + xlim(0, 100)
p3 <- ggplot(Two.SD.High.Wind.Data, aes(x=Sell)) +
geom_histogram(color="black", fill="white") + geom_vline(aes(xintercept=mean(Sell)),
color="blue", linetype="dashed", size=1) +
geom_histogram(aes(y=..density..), colour="black", fill="white")+
geom_density(alpha=.2, fill="#FF6666") +
labs(title="Wind Generation at (Mean + 2 S.D.)",x="Sell Price(British Pounds)", y = "Count")+
theme_classic() + xlim(0, 100)
p4 <- ggplot(Three.SD.High.Wind.Data, aes(x=Sell)) +
geom_histogram(color="black", fill="white") + geom_vline(aes(xintercept=mean(Sell)),
color="blue", linetype="dashed", size=1) +
geom_histogram(aes(y=..density..), colour="black", fill="white")+
geom_density(alpha=.2, fill="#FF6666") +
labs(title="Wind Generation at (Mean + 3 S.D.)",x="Sell Price(British Pounds)", y = "Count")+
theme_classic() + xlim(0, 100)
p5 <- ggplot(Four.SD.High.Wind.Data, aes(x=Sell)) +
geom_histogram(color="black", fill="white") + geom_vline(aes(xintercept=mean(Sell)),
color="blue", linetype="dashed", size=1) +
geom_histogram(aes(y=..density..), colour="black", fill="white")+
geom_density(alpha=.2, fill="#FF6666") +
labs(title="Wind Generation at (Mean + 4 S.D.)",x="Sell Price(British Pounds)", y = "Count")+
theme_classic() + xlim(0, 100)
multiplot(p1, p2, p3, p4, p5, cols=2)
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## Warning: Removed 79 rows containing non-finite values (stat_bin).
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## Warning: Removed 79 rows containing non-finite values (stat_bin).
## Warning: Removed 79 rows containing non-finite values (stat_density).
## Warning: Removed 2 rows containing missing values (geom_bar).
## Warning: Removed 2 rows containing missing values (geom_bar).
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## Warning: Removed 16 rows containing non-finite values (stat_bin).
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## Warning: Removed 16 rows containing non-finite values (stat_bin).
## Warning: Removed 16 rows containing non-finite values (stat_density).
## Warning: Removed 2 rows containing missing values (geom_bar).
## Warning: Removed 2 rows containing missing values (geom_bar).
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## Warning: Removed 2 rows containing missing values (geom_bar).
## Warning: Removed 2 rows containing missing values (geom_bar).
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## Warning: Removed 2 rows containing missing values (geom_bar).
## Warning: Removed 2 rows containing missing values (geom_bar).
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## Warning: Removed 2 rows containing missing values (geom_bar).
## Warning: Removed 2 rows containing missing values (geom_bar).