-
Notifications
You must be signed in to change notification settings - Fork 4
/
prices.qmd
817 lines (626 loc) · 25.4 KB
/
prices.qmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
---
title: "Price of Electricity"
subtitle: "Electricity Prices for the Residential, Commercial, and Industrial Customer Classes, 2011-2019"
---
```{r}
#| output: false
library(readr)
library(dplyr)
library(tidyr)
library(stringr)
library(ggplot2)
library(ggiraph)
library(see) # slices violin plots in half
library(ggridges) # mountains beyond mountains
library(ggrepel) # labels on ends of lines
library(ggdist) # raincloud plots
library(ggrain) # other raincloud package
weighted_prices <- read_csv("./data/final_data/weighted_prices.csv")
prices <- read_csv("./data/final_data/prices.csv")
# Function declaration
source("scripts/inline_functions/price_inline_functions.R")
source("scripts/R/theme_electrified.R")
weighted_prices <- read_csv("./data/final_data/weighted_prices.csv")
# Function to make space regardless of execution format
# To use: write `r space() outside of a code block
# Modify globally at ./scripts/inline_functions/space.R
source("scripts/R/space.R")
```
::: {.content-visible when-format="html"}
```{ojs}
// load libraries
stdlib = require("@observablehq/stdlib")
d3 = require("d3@7")
import {tidy, groupBy, rename, summarize, sum, mutate, select, n, nDistinct, mean, filter, pivotWider, pivotLonger, leftJoin, slice} from "@pbeshai/tidyjs"
// load data
prices = FileAttachment("data/final_data/prices.csv").csv({typed: true});
weighted_prices = FileAttachment("data/final_data/weighted_prices.csv").csv({typed: true});
```
:::
`r space(br="", vspace="-3em")`
## General Overview {#sec-prices}
Utilities in Alaska serve multiple customers, namely residential, commercial, industrial, government/municipal, and community customer classes. Each customer class experiences a different set of costs such as per kWh charge as well as monthly customer charges. In this section, we aim to highlight trends in electricity prices for the residential, commercial, and other customer classes across the Coastal, Railbelt, and Rural Remote regions. We again restrict the data years in this section to 2011 to 2019 due to concerns with data validity for 2020-21.
In rural areas, many communities are eligible to participate in the PCE program (described in @sec-pce-description). It is important to note that the prices presented here reflect the post-PCE adjustment and are annualized averages based on the calendar year. Yearly average effective rates listed here reflect the calendar year and not the fiscal year, which will make them different from those reported in the AEA’s annual reports. We also note that for PCE communities, the rates are reported in the original data. For data sourced from the EIA, rates were calculated by dividing total revenue by total kWh sold in each customer class - this may overestimate the rate as this would include revenue from customer charges.
Note that all prices in this section have been adjusted for inflation over time to 2021 dollars using the Bureau of Labor Statistics (BLS) Consumer Price Index (CPI) for all items in urban Alaska (BLS CUUSA427SA0). To our knowledge, there is no CPI that properly accounts for price changes over time in rural Alaska. However, the general trend shows that customer account-weighted prices have been relatively stagnant across all regions of the state.
### Regional Overview
::: {.content-visible when-format="html"}
@fig-price-regions-classes-html shows the distribution of prices across a selected customer class. The three classes used in this analysis can be selected from the dropdown menu. Hover your pointer over the dot to display utility information.
Most notably, the dramatic effects of the PCE subsidy can be seen by comparing the price distribution of the residential customer class against the price distribution of the commercial/other customer classes in the Rural Remote and Coastal regions.
`r space()`
```{r}
# desired future inputs:
# community size
# sector
# year
# weighted/unweighted
```
```{ojs}
// active inputs
viewof dimension = Inputs.select(new Map([
["Residential", 'residential_price'],
["Commercial", 'commercial_price'],
["Other", 'other_price']]),
{value: "Residential", label: "Customer Class:"}
);
// viewof flipCoords = Inputs.toggle({ label: 'Flip', value: false })
// Inputs.table(customers_pivot)
```
```{ojs}
// hardcoded inputs here
// viewof thresholds = Inputs.select([10, 20, 60], { label: 'Bins', value: 60 })
thresholds = 40
// viewof seed = Inputs.range([1, 100], { step: 1, label: 'Raw Data Seed', value: 1 })
seed = 1
// viewof rawDataSize = Inputs.range([10, 100], { value: 40, step: 10, label: 'Raw Data Size (%)' })
rawDataSize = 20
// viewof rawDataOffset = Inputs.range([0, 50], { value: 5, step: 5, label: 'Raw Data Offset (%)' })
rawDataOffset = 5
```
```{ojs, fig.pos = "H"}
//| label: fig-price-regions-classes-html
//| fig-cap: "Prices by Region and Customer Class"
//| class: raincloud-custom
Plot.plot(rainCloudX)
```
```{ojs}
rainCloudX = ({
grid: true,
label: null,
width: width,
marks: [
Plot.ruleX([0]),
halfViolinX,
rawDataX
],
facet: {
data: data,
y: 'acep_energy_region',
marginRight: 80
},
x: {
label: "Cents per Kilowatt Hour"
},
y: {
ticks: 0,
tickFormat: d => d < 0 ? '' : d
},
color: {
domain: ["Coastal", "Railbelt", "Rural Remote"],
range: ["#8CBBDA", "#97CD93", "#F28D8C"]
}
})
```
```{ojs}
halfViolinX = Plot.areaY(
data,
Plot.binX(
{
y: 'count'
},
{
x: dimension,
fill: 'acep_energy_region',
thresholds: thresholds,
curve: 'basis'
}
)
)
```
```{ojs}
rawDataX = Plot.dot(
data,
{
x: dimension,
y: jitter(data, seed),
fill: 'acep_energy_region',
r: 1.5,
channels: {Name: "reporting_name", Year: "year"},
tip: {format: {fill: false,
fy: false,
y: false
}}
}
)
// tip = Plot.tip(
// data, Plot.pointer(
// {
// x: dimension,
// y: 'acep_energy_region',
// format: {
// year: true,
// reporting_name: true,
// dimension: true,
// filter: (d) => d.reporting_name,
// title: (d) => [d.reporting_name, d.year].join("\n\n")
// stroke: false
// }
// }
// )
// )
```
```{ojs}
//| echo: false
// appendix
jitter = (data, seed) => {
const rng = seedrandom(seed);
return data.map(() => -(rng() * rawDataSize + rawDataOffset) * maxTotal / 100);
}
maxTotal = d3.max(
Array.from(
d3
.group(data, d => d.aea_energy_region)
.values()
)
.flatMap(g => bins(g.map(d => d[dimension])))
.map(bin => bin.length)
)
bins = d3
.bin()
.domain(d3.extent(data, d => d[dimension]))
.thresholds(thresholds)
seedrandom = require('seedrandom')
```
```{ojs}
prices_tidy = tidy(
prices,
rename({
'residential_price_kwh_2021_dollars': 'residential_price',
'commercial_price_kwh_2021_dollars': 'commercial_price',
'other_price_kwh_2021_dollars': 'other_price',
}),
// pivotLonger({
// cols: ['residential', 'commercial', 'other'],
// namesTo: 'sector',
// valuesTo: 'price'
// }),
select([
'year',
'reporting_name',
'acep_energy_region',
'residential_price',
'commercial_price',
'other_price'
])
)
customers_pivot = tidy(
prices,
rename({
'residential_price_kwh_2021_dollars': 'residential_price',
'commercial_price_kwh_2021_dollars': 'commercial_price',
'other_price_kwh_2021_dollars': 'other_price',
}),
rename({
'residential_customers': 'residential',
'commercial_customers': 'commercial',
'other_customers': 'other',
}),
pivotLonger({
cols: ['residential', 'commercial', 'other'],
namesTo: 'sector',
valuesTo: 'customers'
}),
select([
'year',
'reporting_name',
'acep_energy_region',
'residential_price',
'commercial_price',
'other_price',
'customers',
'total_customers'
])
)
// prices_customers_long = tidy(
// prices_pivot,
// leftJoin(customers_pivot,
// { by: ['year', 'aea_sales_reporting_id', 'reporting_name', 'sector'] }),
// select([
// 'year',
// 'reporting_name',
// 'acep_energy_region',
// 'sector',
// 'price',
// 'customers',
// 'total_customers'
// ])
// )
data = tidy(
prices_tidy,
mutate({
residential_price: (d) => d.residential_price === 0 ? null : d.residential_price,
commercial_price: (d) => d.commercial_price === 0 ? null : d.commercial_price,
other_price: (d) => d.other_price === 0 ? null : d.other_price,
}),
filter((d) => d.year < 2020),
filter((d) => d.reporting_name != "Lime Village"),
filter((d) => d.reporting_name != "Healy Lake")
);
```
`r space()`
`r space()`
:::
::: {.content-visible when-format="pdf"}
```{r}
p_prices <- prices %>%
rename(c("residential" = "residential_price_kwh_2021_dollars",
"commercial" = "commercial_price_kwh_2021_dollars",
"other" = "other_price_kwh_2021_dollars")) %>%
pivot_longer(
cols = c("residential",
"commercial",
"other"),
names_to ="sector",
values_to = "price")
long_price <- p_prices %>%
mutate(customers = NA) %>%
mutate(customers = ifelse(sector == "residential", residential_customers, customers)) %>%
mutate(customers = ifelse(sector == "commercial", commercial_customers, customers)) %>%
mutate(customers = ifelse(sector == "other", other_customers, customers)) %>%
mutate(customers = round(customers, 0)) %>%
select("year",
"reporting_name",
"acep_energy_region",
"sector",
"price",
"customers",
"total_customers")
```
```{r eval=knitr::is_latex_output(), fig.pos = "H"}
raincloud <- function(sector_input="residential", start_year=2011, end_year=2019, x_axis_max=65){
d <- long_price %>%
filter(sector == sector_input) %>%
filter(price > 0) %>%
filter(year >= start_year & year <= end_year) %>%
left_join(weighted_prices, join_by(year, sector, acep_energy_region))
output <-
ggplot(d) +
geom_violinhalf(
aes(x=acep_energy_region,
y=price,
fill=acep_energy_region),
position = position_nudge(x=.1, y=0)) +
geom_jitter(
aes(x=acep_energy_region, y=price),
color="black",
alpha=0.25,
width = .05,
height = 0) +
scale_fill_manual(values = c("#98BAD6", "#A4CD9A", "#E3918F")) +
scale_color_manual(values = c("#98BAD6", "#A4CD9A", "#E3918F")) +
scale_y_continuous(
breaks = seq(0, x_axis_max, 20),
limits = c(0, x_axis_max),
expand = c(0, 0, 0, 0.5)) +
theme_electrified() +
theme(legend.position = "none",
panel.grid.major.y = element_blank()
) +
labs(x = "", y = "Cents per kWh") +
# ylim(c(0,x_axis_max)) + #remember the coord_flip, y axis is now the x axis
coord_flip()
#E3918F Rural Remote
#98BAD6 Coastal
#A4CD9A Railbelt
#F1BF42 State
print(output)
}
```
:::
::: {.content-visible when-format="pdf"}
Below are three raincloud plots to show the distribution of prices across the three customer classes. @fig-price-regions-residential shows Residential prices, @fig-price-regions-commercial shows Commercial prices, and @fig-price-regions-other shows prices for Other customers. Each dot on the graphs represents the average annual price of a community for a single year in the range. For this report, data is displayed for 9 years, 2011-2019, therefore each community will render 9 points on the plot. Communities are grouped by the three regions, and the colored half-violin above the dots shows distributions of the prices.
`r space()`
```{r eval=knitr::is_latex_output(), fig.pos = "H"}
#| label: fig-price-regions-residential
#| fig-cap: "Residential Sector Prices, 2011-2019"
raincloud(
sector_input="residential",
start_year=2011,
end_year=2019,
x_axis_max=120)
```
Most notably, the dramatic effects of the PCE subsidy can be seen by comparing the price distribution of the residential customer class against the price distribution of the commercial/other customer classes in the Rural Remote and Coastal regions.
`r space()`
```{r eval=knitr::is_latex_output(), fig.pos = "H"}
#| label: fig-price-regions-commercial
#| fig-cap: "Commercial Sector Prices, 2011-2019"
raincloud(
sector_input="commercial",
start_year=2011,
end_year=2019,
x_axis_max=120)
```
`r space()`
```{r eval=knitr::is_latex_output(), fig.pos = "H"}
#| label: fig-price-regions-other
#| fig-cap: "Other Sector Prices, 2011-2019"
raincloud(
sector_input="other",
start_year=2011,
end_year=2019,
x_axis_max=120)
```
`r space()`
:::
### Regional Averages
Due to the wide range of electricity prices in Alaska, it is difficult to accurately summarize the data. Because of this, we determined that averages were best calculated using a customer account weighted average. Population is roughly correlated to price, with small communities experiencing higher rates than larger communities. The average number of customer accounts for the year was used to calculate the weighted arithmetic mean price for each year and region. `r if (knitr::is_html_output())"@fig-price-over-time-html" else if (knitr::is_latex_output()) "@fig-price-over-time-pdf"` is a graph of residential customer prices over time after weighting for the number of customer accounts.
`r space()`
```{r}
# code for both html and pdf
region_residential_weighted_prices <-
weighted_prices %>%
filter(year < 2020 & sector == "residential") %>%
rename(`ACEP Region` = acep_energy_region, Sector = sector)
# filter the last year for each region for the text labels
last_year_data <- region_residential_weighted_prices %>%
group_by(`ACEP Region`) %>%
filter(year == max(year))
regions_plot <-
ggplot(
region_residential_weighted_prices,
aes(
x = year,
y = weighted_price,
color = `ACEP Region`,
group = `ACEP Region`)) +
geom_text(
data = last_year_data,
aes(label = `ACEP Region`),
hjust = 1.1,
vjust = 2.5) +
scale_x_continuous(
name = "Year",
breaks = seq(2011, 2019, 1),
expand = c(0, 0, 0, 0.1)) +
scale_y_continuous(
name = "Cents per Kilowatt Hour",
limits = c(16, 28),
breaks = seq(16, 28, 2),
expand = c(0, 0)) +
scale_color_manual(values = c("#8CBBDA", "#97CD93", "#F28D8C")) +
theme_electrified() +
theme(legend.position = "none")
```
```{r, eval=knitr::is_html_output(), fig.pos = "H"}
#| label: fig-price-over-time-html
#| fig-cap: "Residential Price Over Time"
regions_html <-
regions_plot +
geom_line_interactive(linewidth = 2) +
geom_point_interactive(
aes(
tooltip = paste(
"Year:", year,
"<br>Region:", `ACEP Region`,
"<br>Cents per Kilowatt Hour:", round(weighted_price, 2))
),
size = 10, color = "transparent")
girafe(code = print(regions_html))
```
```{r, eval=knitr::is_latex_output(), fig.pos = "H"}
#| label: fig-price-over-time-pdf
#| fig-cap: "Residential Price Over Time"
regions_pdf <-
regions_plot +
geom_line(linewidth = 2)
print(regions_pdf)
```
`r space()`
::: {.content-visible when-format="pdf"}
\newpage
:::
## Coastal
`r if (knitr::is_html_output())"@fig-price-sector-coastal-html" else if (knitr::is_latex_output()) "@fig-price-sector-coastal-pdf"` shows the average price of electricity in the Coastal region for each customer class and year. Between 2011 and 2019, the region experienced decreasing prices for Commercial and Other customers, while Residential customers have seen a slight increase in price.
The average real price (in 2021 dollars) of electricity for Residential customers in the Coastal region rose `r price_delta(region="Coastal", sector="residential", pct=TRUE, numeric_out=TRUE)`% from `r price(region="Coastal", sector="residential", year=2011)` cents/kWh in 2011 to `r price(region="Coastal", sector="residential", year=2019)` cents/kWh in 2019. The average price of electricity for Commercial customers in the Coastal region fell `r price_delta(region="Coastal", sector="commercial", pct=TRUE, numeric_out=TRUE)`% from `r price(region="Coastal", sector="commercial", year=2011)` cents/kWh in 2011 to `r price(region="Coastal", sector="commercial", year=2019)` cents/kWh in 2019. Finally, the average price of electricity for Other customers in the Coastal region fell `r price_delta(region="Coastal", sector="other", pct=TRUE, numeric_out=TRUE)`% from `r price(region="Coastal", sector="other", year=2011)` cents/kWh in 2011 to `r price(region="Coastal", sector="other", year=2019)` cents/kWh in 2019.
Residential customers in the Coastal region saw increases in the price of electricity while commercial and other customers saw decreases. However, the residential customer class continues to pay the lowest per kWh in the region due to a combination of low prices in high population areas and PCE subsidies in eligible communities.
`r space()`
```{r}
coastal_weighted_prices <-
weighted_prices %>%
filter(year < 2020 &
acep_energy_region == "Coastal") %>%
rename(`ACEP Region` = acep_energy_region, Sector = sector) %>%
mutate(Sector = str_to_title(Sector))
# Filter the last year for each region for the text labels
last_year_data <- coastal_weighted_prices %>%
group_by(`Sector`) %>%
filter(year == max(year))
coastal_plot <-
ggplot(
coastal_weighted_prices,
aes(x = year, y = weighted_price, color = Sector)) +
geom_text(
data = last_year_data,
aes(label = Sector),
hjust = 1.05,
vjust = -1) +
scale_x_continuous(
name = "Year",
breaks = seq(2011, 2019, 1),
expand = c(0, 0, 0, 0.1)) +
scale_y_continuous(
name = "Cents per Kilowatt Hour",
limits = c(10, 40.5),
breaks = seq(10, 40.5, 10),
expand = c(0, 0)) +
scale_color_manual(values = c("#e29617", "#fad900", "#0084c1")) +
theme_electrified() +
theme(
legend.position = "none")
```
```{r, eval=knitr::is_html_output(), fig.pos = "H"}
#| label: fig-price-sector-coastal-html
#| fig-cap: "Sector Price Over Time, Coastal Region"
coastal_html <-
coastal_plot +
geom_line_interactive(linewidth = 2) +
geom_point_interactive(
aes(
tooltip = paste(
"Year:", year,
"<br>Sector:", Sector,
"<br>Cents per Kilowatt Hour:", round(weighted_price, 2))
),
size = 10, color = "transparent")
girafe(code = print(coastal_html))
```
```{r, eval=knitr::is_latex_output(), fig.pos = "H"}
#| label: fig-price-sector-coastal-pdf
#| fig-cap: "Sector Price Over Time, Coastal Region"
coastal_pdf <-
coastal_plot +
geom_line(linewidth = 2)
print(coastal_pdf)
```
`r space()`
::: {.content-visible when-format="pdf"}
\newpage
:::
## Railbelt
`r if (knitr::is_html_output())"@fig-price-sector-railbelt-html" else if (knitr::is_latex_output()) "@fig-price-sector-railbelt-pdf"` shows the average price of electricity in the Railbelt region for each customer class and each year of the report. Between 2011 and 2019, Other customers saw a large decrease in price, followed by a gradual increase. Residential and Commercial customers experienced slight decreases in price until 2013 when prices reversed and rose dramatically.
The average real price of electricity for Residential customers in the Railbelt rose `r price_delta(region="Railbelt", sector="residential", pct=TRUE, numeric_out=TRUE)`% from `r price(region="Railbelt", sector="residential", year=2011)` cents/kWh in 2011 to `r price(region="Railbelt", sector="residential", year=2019)` cents/kWh in 2019. The average price of electricity for Commercial customers in the Railbelt rose `r price_delta(region="Railbelt", sector="commercial", pct=TRUE, numeric_out=TRUE)`% from `r price(region="Railbelt", sector="commercial", year=2011)` cents/kWh in 2011 to `r price(region="Railbelt", sector="commercial", year=2019)` cents/kWh in 2019. Finally, the average price of electricity for Other customers in the Railbelt fell `r price_delta(region="Railbelt", sector="other", pct=TRUE, numeric_out=TRUE)`% from `r price(region="Railbelt", sector="other", year=2011)` cents/kWh in 2011 to `r price(region="Railbelt", sector="other", year=2019)` cents/kWh in 2019.
This region differs significantly from the Coastal and Rural Remote regions in that residential customers pay more for electricity than the Commercial or Other customer classes.
`r space()`
```{r}
railbelt_weighted_prices <-
weighted_prices %>%
filter(year < 2020 &
acep_energy_region == "Railbelt") %>%
rename(`ACEP Region` = acep_energy_region, Sector = sector) %>%
mutate(Sector = str_to_title(Sector))
# filter the last year for each region for the text labels
last_year_data <- railbelt_weighted_prices %>%
group_by(`Sector`) %>%
filter(year == max(year))
railbelt_plot <-
ggplot(
railbelt_weighted_prices,
aes(x = year, y = weighted_price, color = Sector)) +
geom_text(
data = last_year_data,
aes(label = Sector),
hjust = 1.05,
vjust = -1) +
scale_x_continuous(
name = "Year",
breaks = seq(2011, 2019, 1),
expand = c(0, 0, 0, 0.1)) +
scale_y_continuous(
name = "Cents per Kilowatt Hour",
limits = c(10, 40.5),
breaks = seq(10, 40.5, 10),
expand = c(0, 0)) +
scale_color_manual(values = c("#e29617", "#fad900", "#0084c1")) +
theme_electrified() +
theme(legend.position = "none")
```
```{r, eval=knitr::is_html_output(), fig.pos = "H"}
#| label: fig-price-sector-railbelt-html
#| fig-cap: "Sector Price Over Time, Railbelt Region"
railbelt_html <-
railbelt_plot +
geom_line_interactive(linewidth = 2) +
geom_point_interactive(
aes(
tooltip = paste(
"Year:", year,
"<br>Sector:", Sector,
"<br>Cents per Kilowatt Hour:", round(weighted_price, 2))
),
size = 10, color = "transparent")
girafe(code = print(railbelt_html))
```
```{r, eval=knitr::is_latex_output(), fig.pos = "H"}
#| label: fig-price-sector-railbelt-pdf
#| fig-cap: "Sector Price Over Time, Railbelt Region"
railbelt_pdf <-
railbelt_plot +
geom_line(linewidth = 2)
print(railbelt_pdf)
```
`r space()`
::: {.content-visible when-format="pdf"}
\newpage
:::
## Rural Remote
`r if (knitr::is_html_output())"@fig-price-sector-rural-html" else if (knitr::is_latex_output()) "@fig-price-sector-rural-pdf"` shows the average price of electricity in the Rural Remote region for each customer class and year of the report. Between 2011 and 2019, Residential customers experienced a gradual increase in rates, while Commercial and Other customers experienced a gradual decrease in rates.
The average price of electricity for the Residential customers in the Rural Remote region rose `r price_delta(region="Rural Remote", sector="residential", pct=TRUE, numeric_out=TRUE)`% from `r price(region="Rural Remote", sector="residential", year=2011)` cents/kWh in 2011 to `r price(region="Rural Remote", sector="residential", year=2019)` cents/kWh in 2019. The average price of electricity for Commercial customers in the Rural Remote region fell `r price_delta(region="Rural Remote", sector="commercial", pct=TRUE, numeric_out=TRUE)`% from `r price(region="Rural Remote", sector="commercial", year=2011)` cents/kWh in 2011 to `r price(region="Rural Remote", sector="commercial", year=2019)` cents/kWh in 2019. Finally, the average price of electricity for Other customers in the Rural Remote region fell `r price_delta(region="Rural Remote", sector="other", pct=TRUE, numeric_out=TRUE)`% from `r price(region="Rural Remote", sector="other", year=2011)` cents/kWh in 2011 to `r price(region="Rural Remote", sector="other", year=2019)` cents/kWh in 2019.
`r space()`
```{r}
rural_remote_weighted_prices <-
weighted_prices %>%
filter(year < 2020 &
acep_energy_region == "Rural Remote") %>%
rename(`ACEP Region` = acep_energy_region, Sector = sector) %>%
mutate(Sector = str_to_title(Sector))
# Filter the last year for each region for the text labels
last_year_data <- rural_remote_weighted_prices %>%
group_by(`Sector`) %>%
filter(year == max(year))
rural_remote_plot <-
ggplot(
rural_remote_weighted_prices,
aes(x = year, y = weighted_price, color = Sector)) +
geom_text(
data = last_year_data,
aes(label = Sector),
hjust = 1.05,
vjust = -1) +
scale_x_continuous(
name = "Year",
breaks = seq(2011, 2019, 1),
expand = c(0, 0, 0, 0.1)) +
scale_y_continuous(
name = "Cents per Kilowatt Hour",
limits = c(10, 70),
breaks = seq(10, 70, 10),
expand = c(0, 0)) +
scale_color_manual(values = c("#e29617", "#fad900", "#0084c1")) +
theme_electrified() +
theme(legend.position = "none",
panel.grid.major.y = element_line(color = "gray", size = 0.1)
)
```
```{r, eval=knitr::is_html_output(), fig.pos = "H"}
#| label: fig-price-sector-rural-html
#| fig-cap: "Sector Price Over Time, Rural Remote Region"
rural_remote_html <-
rural_remote_plot +
geom_line_interactive(linewidth = 2) +
geom_point_interactive(
aes(
tooltip = paste(
"Year:", year,
"<br>Sector:", Sector,
"<br>Cents per Kilowatt Hour:", round(weighted_price, 2))
),
size = 10, color = "transparent")
girafe(code = print(rural_remote_html))
```
```{r, eval=knitr::is_latex_output(), fig.pos = "H"}
#| label: fig-price-sector-rural-pdf
#| fig-cap: "Sector Price Over Time, Rural Remote Region"
rural_remote_pdf <-
rural_remote_plot +
geom_line(linewidth = 2)
print(rural_remote_pdf)
```