House Price Index

setwd("/Users/charten/OneDrive - Glenveagh Properties/Research & Development/1. Analysis/")
GEO_Merge <- readxl::read_xlsx(path="C:\\Users\\charten\\OneDrive - Glenveagh Properties\\Research & Development\\1. Analysis\\HPM04_GEO.xlsx",sheet = 1)
shp <- sf::read_sf("Constituency_Boundaries_Ungeneralised___OSi_National_Electoral_Boundaries___2017.shp")

HPM09 <- cso_get_data("HPM09")
HPM09_long <- HPM09 %>%
  pivot_longer(!1:2, names_to = "year_month")
rm(HPM09)
HPM09 <- HPM09_long
rm(HPM09_long)

HPM09$Month <- as.Date(paste(HPM09$year_month, "01", sep = "-"), "%YM%m-%d")
HPM09$Year <- year(HPM09$Month)
HPM04 <- cso_get_data("HPM04")
HPM04_long <- HPM04 %>%
  pivot_longer(!1:5, names_to = "year_month")
rm(HPM04)
HPM04 <- HPM04_long
rm(HPM04_long)
### Date transformation
HPM04$Year <-substr(HPM04$year_month,1,4)
HPM04$Month <- sub(".* ", "", HPM04$year_month)
HPM04$Month_NR <- as.integer(factor(HPM04$Month, levels=month.name))
HPM04$Date <- as.yearmon(paste(HPM04$Year, HPM04$Month_NR), "%Y %m")
HPM04_join <- full_join(HPM04, GEO_Merge, by = "Eircode.Output")
HPM04 <- HPM04_join
rm(HPM04_join)
HPM09$Year <-substr(HPM09$year_month,1,4)
HPM09$Month <- sub(".* ", "", HPM09$year_month)
HPM09$Month_NR <- as.integer(factor(HPM09$Month, levels=month.name))
HPM09$Date <- as.yearmon(paste(HPM09$Year, HPM09$Month_NR), "%Y %m")

HPM09_1 <- HPM09 %>%
  filter(Statistic == "Residential Property Price Index")%>%
  filter(Type.of.Residential.Property == "National - all residential properties")

HPM09_2 <- HPM09 %>%
  filter(Statistic == "Percentage Change over 12 months for Residential Property Price Index")%>%
  filter(Type.of.Residential.Property == "National - all residential properties")

RPPI_tail_2 <- tail(HPM09_2,1)
RPPI_tail_2_lag <-head(tail(HPM09_2,2),1)
RRPI_Line_1 <- ggplot(data=HPM09_1, aes(x=Date, y=value, group = Type.of.Residential.Property))+
  geom_line(linejoin="mitre",size = 1.25, linetype = 1,alpha = 0.5, colour="#1b5545")+
  labs(title = "Residential Property Price Index" ,
       y="2015 = 100",
       x="Month")+
  geom_text_repel(aes(label=value),data = HPM09_1, size = 3)+
  theme_bw()+
  theme(legend.position = "bottom")+theme(axis.text.x = element_text(angle = 90, vjust = 0.5, hjust=1))

HPM09_1_T12 <- tail(HPM09_1,12)
RRPI_Line_2 <- ggplot(data=HPM09_1_T12, aes(x=Date, y=value, group = Type.of.Residential.Property))+
  geom_line(linejoin="mitre",size = 1.25, linetype = 1,alpha = 0.5, colour="#1b5545")+
  labs(title = "Residential Property Price Index" ,
       subtitle = "12 Month Series",
       y="2015 = 100",
       x="Month")+
  geom_text(aes(label=value),vjust= 1.5, hjust = 0, size=3)+
  theme_bw()+
  theme(legend.position = "bottom")+theme(axis.text.x = element_text(angle = 90, vjust = 0.5, hjust=1))

RRPI_Line_1+RRPI_Line_2+plot_layout(ncol = 2)

HPM09_2_T24 <- tail(HPM09_2,24)
colour <- ifelse(HPM09_2_T24$value < 0,"#CC0000","#1b5545")
RPPI_Bar_2 <- ggplot(data=HPM09_2_T24, aes(x=Date, y=value, group = Type.of.Residential.Property))+
  geom_col(alpha = 0.5, colour="#373634", fill = colour)+
  labs(title = "Year on Year Percentage Change for Residential Property Price Index" ,
       subtitle = "24 Month Series",
       y="Percentage change",
       x="Month")+
  geom_text(aes(label=value),vjust= 1.5, size=3)+
  theme_bw()+
  theme(legend.position = "bottom")+

rm(HPM09)

The national house price inflation for is 13%. This represents a -1 change from which was 14%.

# Data Clean
HPM04_1A <- HPM04 %>%
  filter(Statistic == "Mean Sale Price")%>%
  filter(Dwelling.Status == "All Dwelling Statuses") %>%
  filter(Stamp.Duty.Event == "Executions") %>%
  filter(Type.of.Buyer == "All Buyer Types") %>%
  filter(Eircode.Output == "All")

HPM04_1B <- HPM04 %>%
  filter(Statistic == "Mean Sale Price")%>%
  filter(Dwelling.Status == "All Dwelling Statuses") %>%
  filter(Stamp.Duty.Event == "Executions") %>%
  filter(Type.of.Buyer == "All Buyer Types") %>%
  filter(Eircode.Output != "All")

HPM04_1B_Map <- na.omit(HPM04_1B)
HPM04_1B_Map<- HPM04_1B_Map %>%
  group_by(Seat_Tag, Date)%>% # change to/from County / Constituency
  summarise(Average_Value = mean(value))

HPM04_1B_Map$lagvalue_12mth <- Lag(HPM04_1B_Map$Average_Value,12)
HPM04_1B_Map$Diff <- HPM04_1B_Map$Average_Value - HPM04_1B_Map$lagvalue_12mth
HPM04_1B_Map$Diffpc <- HPM04_1B_Map$Diff / HPM04_1B_Map$lagvalue_12mth
HPM04_1B_Map$Diffpc<-percent(HPM04_1B_Map$Diffpc,2)

HPM04_1B_Map_July2022 <- HPM04_1B_Map%>%
  filter(Date == "July 2022") # change month

shpHPM <- merge(shp,HPM04_1B_Map_July2022, by.x = "CON_SEAT_", by.y="Seat_Tag")
HPM04_1B_Map_July2022_Dub <- HPM04_1B_Map_July2022 %>% 
  filter(grepl('Dublin|Laoghaire|Meath|Wicklow|Kildare|Louth', Seat_Tag))

# Labs_HPI <- ED %>%
#   filter(EDNAME=="Trim Urban"|EDNAME=="Navan Urban"|EDNAME=="Dunboyne"|EDNAME=="Innfield") 

shpHPMDub <- merge(shp,HPM04_1B_Map_July2022_Dub, by.x = "CON_SEAT_", by.y="Seat_Tag")

# Maps
Map2_DiffpcAll <-  shpHPM %>%
  ggplot()+
  geom_sf(aes(fill = Diffpc),colour=alpha("gray",0.4))+
 scale_fill_stepsn(n.breaks = 10,
    colors=c("#F92306","#FFFFFF","#0C4F00"),
    limits = c(-1,1),
    name = "% change")+
    ggtitle('Year on Year Change by Constituency - HPM04')+
  theme_void()+
  theme(legend.title = element_text(size = 10),
        legend.text = element_text(size = 8))+
    theme(legend.position = "left")+
  theme(plot.title = element_text(hjust = 1))

Map2_DiffpcDub <- shpHPMDub %>%
  ggplot()+
  geom_sf(aes(fill = Diffpc),colour=alpha("gray",0.4))+
  geom_sf_text(aes(label=Diffpc),color="black",alpha=0.9,size=1.75)+
  scale_fill_stepsn(n.breaks = 10,
    colors=c("#F92306","#FFFFFF","#0C4F00"),
    limits = c(-1,1),
    name = "% change")+
    theme_void()+
  theme(legend.position = "none")


Map2_Diffpc <- Map2_DiffpcAll + Map2_DiffpcDub +
  plot_layout(widths = c(2,1))

Map2_Diffpc

Average percentage change year on year is 13.85%. This was 8.62% in the Dublin constituencies.

These averages the mean value of the below:

HPM04_1B_Map_July2022%>%
  kbl(caption = "Year on Year ")%>%
  kable_styling(bootstrap_options = c("striped", "hover", "condensed"), full_width = T)%>%
  scroll_box(width = "700px", height = "300px") 
Year on Year
Seat_Tag Date Average_Value lagvalue_12mth Diff Diffpc
Carlow-Kilkenny (5) Jul 2022 284872.0 220894.3 63977.67 28.96%
Cavan-Monaghan (5) Jul 2022 197903.0 161570.4 36332.57 22.49%
Clare (4) Jul 2022 235955.7 206092.7 29863.00 14.49%
Cork East (4) Jul 2022 267323.0 256206.0 11117.00 4.34%
Cork North-Central (4) Jul 2022 350839.5 309962.5 40877.00 13.19%
Cork North-West (3) Jul 2022 348709.2 239320.7 109388.53 45.71%
Cork South-Central (4) Jul 2022 330230.0 328309.0 1921.00 0.59%
Cork South-West (3) Jul 2022 289256.5 244953.5 44303.00 18.09%
Donegal (5) Jul 2022 182673.3 156738.0 25935.33 16.55%
Dublin Bay North (5) Jul 2022 581319.0 494264.3 87054.67 17.61%
Dublin Bay South (4) Jul 2022 798902.3 804848.3 -5946.00 -0.74%
Dublin Central (4) Jul 2022 309083.0 306544.0 2539.00 0.83%
Dublin Fingal (5) Jul 2022 466015.0 420827.3 45187.67 10.74%
Dublin Mid-West (4) Jul 2022 400853.5 370367.5 30486.00 8.23%
Dublin North-West (3) Jul 2022 458754.0 434262.0 24492.00 5.64%
Dublin Rathdown (3) Jul 2022 731581.0 687356.0 44225.00 6.43%
Dublin South-West (5) Jul 2022 572909.0 515215.0 57694.00 11.20%
Dublin South Central (4) Jul 2022 415488.8 423227.6 -7738.80 -1.83%
Dublin West (4) Jul 2022 418237.5 385500.0 32737.50 8.49%
Dun Laoghaire (4) Jul 2022 821332.5 721735.0 99597.50 13.80%
Galway East (3) Jul 2022 340027.0 228739.0 111288.00 48.65%
Galway West (5) Jul 2022 497739.0 265832.0 231907.00 87.24%
Kerry (5) Jul 2022 226333.2 222134.2 4199.00 1.89%
Kildare North (4) Jul 2022 419878.0 366211.0 53667.00 14.65%
Kildare South (4) Jul 2022 297297.0 277221.6 20075.40 7.24%
Laois-Offaly (5) Jul 2022 225580.0 198517.5 27062.50 13.63%
Limerick City (4) Jul 2022 261463.0 255035.0 6428.00 2.52%
Limerick County (3) Jul 2022 208000.0 196158.0 11842.00 6.04%
Longford-Westmeath (4) Jul 2022 221291.0 192877.0 28414.00 14.73%
Louth (5) Jul 2022 296199.5 269990.5 26209.00 9.71%
Mayo (4) Jul 2022 190733.7 166644.2 24089.50 14.46%
Meath East (3) Jul 2022 346002.4 317400.2 28602.20 9.01%
Meath West (3) Jul 2022 345554.0 308129.0 37425.00 12.15%
Roscommon-Galway (3) Jul 2022 204672.3 166230.7 38441.67 23.13%
Sligo-Leitrim (4) Jul 2022 168374.2 158717.5 9656.75 6.08%
Tipperary (5) Jul 2022 222141.2 184001.6 38139.62 20.73%
Waterford (4) Jul 2022 217256.7 243727.0 -26470.33 -10.86%
Wexford (5) Jul 2022 229463.2 227119.5 2343.75 1.03%
Wicklow (5) Jul 2022 447703.8 394752.0 52951.75 13.41%

Housing Stock

BCMS - Commencement notices taken from gov.ie. Completions and planning permissions data taken from the CSO. Commencement notices unavailable for apartments.

Regional planning permissions data from the CSO first became available from Q1 2018.

National

Fig1 + Fig2 + plot_layout(widths = c(1.5,1))

Commencement notices have become more noticably more volatile since 2020. Planning and completions for all units appears to be returning somewhat to trend on the left panel above. The panel on the right gives a clearer picture of the mismatch with the housing stock today.

There are too many apartment units being planned but not built, due to commercial viability they likely will never be built.

Local Authority Areas

Map1<-shpData.LA_merge %>%
  ggplot()+
  geom_sf(aes(fill = C_of_P,alpha=0.9))+
  theme_void()+
  scale_fill_distiller(palette = "Spectral", name="Ratio")+
  labs(title="Completions to Planning Ratio: 2018 to Date",
       caption = "CSO Datasets NDQ06 & BHQ12 used for completions and planning respectively")+
  facet_wrap(~Type.of.Dwelling.x,ncol=2)

Map1

There were 172599 permissions granted & 93525 completions in the sample

The ratio above is the number of completions relative to permissions granted for houses and apartments in a given area.

I am not sure what an ideal ratio would be , but a replacement rate is naturally 1. So those running above 1 will exhaust supply quicker and lead to a tighter market (locally). The lower end of the scale suggests there is capacity for more units to be supplied, but of course this does not mean they will be.

Data.LA_bind <- Data.LA_bind %>%
  select(1:4)
Data.LA_bind%>%
  kbl(caption = "Completion & Planning Permission Data ")%>%
  kable_styling(bootstrap_options = c("striped", "hover", "condensed"), full_width = T)%>%
  scroll_box(width = "700px", height = "400px") 
Completion & Planning Permission Data
Statistic Local.Authority Type.of.Dwelling value
Units for which Permission Granted Leitrim Apartment 32
Units for which Permission Granted Leitrim Houses 265
Units for which Permission Granted Sligo Apartment 76
Units for which Permission Granted Sligo Houses 810
Units for which Permission Granted Cavan Apartment 55
Units for which Permission Granted Cavan Houses 1053
Units for which Permission Granted Donegal Apartment 272
Units for which Permission Granted Donegal Houses 2790
Units for which Permission Granted Monaghan Apartment 72
Units for which Permission Granted Monaghan Houses 1320
Units for which Permission Granted Galway Apartment 577
Units for which Permission Granted Galway Houses 3964
Units for which Permission Granted Galway City Apartment 1672
Units for which Permission Granted Galway City Houses 669
Units for which Permission Granted Mayo Apartment 106
Units for which Permission Granted Mayo Houses 1518
Units for which Permission Granted Roscommon Apartment 77
Units for which Permission Granted Roscommon Houses 691
Units for which Permission Granted Clare Apartment 197
Units for which Permission Granted Clare Houses 2137
Units for which Permission Granted Limerick Apartment 1552
Units for which Permission Granted Limerick Houses 3537
Units for which Permission Granted Tipperary Apartment 427
Units for which Permission Granted Tipperary Houses 2519
Units for which Permission Granted Carlow Apartment 110
Units for which Permission Granted Carlow Houses 848
Units for which Permission Granted Kilkenny Apartment 636
Units for which Permission Granted Kilkenny Houses 2362
Units for which Permission Granted Wexford Apartment 1010
Units for which Permission Granted Wexford Houses 4880
Units for which Permission Granted Waterford Apartment 708
Units for which Permission Granted Waterford Houses 2777
Units for which Permission Granted Cork Apartment 2156
Units for which Permission Granted Cork Houses 10477
Units for which Permission Granted Cork City Apartment 5362
Units for which Permission Granted Cork City Houses 2295
Units for which Permission Granted Kerry Apartment 416
Units for which Permission Granted Kerry Houses 1785
Units for which Permission Granted Dublin City Apartment 31097
Units for which Permission Granted Dublin City Houses 1268
Units for which Permission Granted South Dublin Apartment 7627
Units for which Permission Granted South Dublin Houses 3148
Units for which Permission Granted Fingal Apartment 7412
Units for which Permission Granted Fingal Houses 3071
Units for which Permission Granted Dun Laoghaire - Rathdown Apartment 15582
Units for which Permission Granted Dun Laoghaire - Rathdown Houses 2186
Units for which Permission Granted Kildare Apartment 3496
Units for which Permission Granted Kildare Houses 7297
Units for which Permission Granted Louth Apartment 2131
Units for which Permission Granted Louth Houses 2441
Units for which Permission Granted Meath Apartment 2953
Units for which Permission Granted Meath Houses 6343
Units for which Permission Granted Wicklow Apartment 2034
Units for which Permission Granted Wicklow Houses 4048
Units for which Permission Granted Laois Apartment 396
Units for which Permission Granted Laois Houses 2573
Units for which Permission Granted Longford Apartment 41
Units for which Permission Granted Longford Houses 612
Units for which Permission Granted Offaly Apartment 206
Units for which Permission Granted Offaly Houses 1686
Units for which Permission Granted Westmeath Apartment 937
Units for which Permission Granted Westmeath Houses 1804
New Dwelling Completion Cork City Apartment 512
New Dwelling Completion Cork City Houses 3098
New Dwelling Completion Clare Apartment 82
New Dwelling Completion Clare Houses 1670
New Dwelling Completion Cavan Apartment 41
New Dwelling Completion Cavan Houses 779
New Dwelling Completion Cork Apartment 276
New Dwelling Completion Cork Houses 6032
New Dwelling Completion Carlow Apartment 22
New Dwelling Completion Carlow Houses 961
New Dwelling Completion Dublin City Apartment 7715
New Dwelling Completion Dublin City Houses 2258
New Dwelling Completion Dun Laoghaire - Rathdown Apartment 3778
New Dwelling Completion Dun Laoghaire - Rathdown Houses 2100
New Dwelling Completion Donegal Apartment 189
New Dwelling Completion Donegal Houses 2030
New Dwelling Completion Fingal Apartment 2007
New Dwelling Completion Fingal Houses 6599
New Dwelling Completion Galway Apartment 153
New Dwelling Completion Galway Houses 3178
New Dwelling Completion Galway City Apartment 232
New Dwelling Completion Galway City Houses 827
New Dwelling Completion Kildare Apartment 451
New Dwelling Completion Kildare Houses 7243
New Dwelling Completion Kilkenny Apartment 156
New Dwelling Completion Kilkenny Houses 1268
New Dwelling Completion Kerry Apartment 156
New Dwelling Completion Kerry Houses 2065
New Dwelling Completion Longford Apartment 25
New Dwelling Completion Longford Houses 451
New Dwelling Completion Louth Apartment 249
New Dwelling Completion Louth Houses 2705
New Dwelling Completion Limerick Apartment 195
New Dwelling Completion Limerick Houses 2370
New Dwelling Completion Leitrim Apartment 18
New Dwelling Completion Leitrim Houses 237
New Dwelling Completion Laois Apartment 71
New Dwelling Completion Laois Houses 1332
New Dwelling Completion Meath Apartment 192
New Dwelling Completion Meath Houses 6562
New Dwelling Completion Monaghan Apartment 68
New Dwelling Completion Monaghan Houses 917
New Dwelling Completion Mayo Apartment 74
New Dwelling Completion Mayo Houses 1682
New Dwelling Completion Offaly Apartment 55
New Dwelling Completion Offaly Houses 967
New Dwelling Completion Roscommon Apartment 40
New Dwelling Completion Roscommon Houses 726
New Dwelling Completion South Dublin Apartment 1092
New Dwelling Completion South Dublin Houses 5464
New Dwelling Completion Sligo Apartment 101
New Dwelling Completion Sligo Houses 595
New Dwelling Completion Tipperary Apartment 138
New Dwelling Completion Tipperary Houses 1191
New Dwelling Completion Waterford Apartment 157
New Dwelling Completion Waterford Houses 1956
New Dwelling Completion Westmeath Apartment 96
New Dwelling Completion Westmeath Houses 1025
New Dwelling Completion Wicklow Apartment 443
New Dwelling Completion Wicklow Houses 3659
New Dwelling Completion Wexford Apartment 159
New Dwelling Completion Wexford Houses 2635

Daft Price Analysis

There are 40974 observations in the Daft dataset with the first listing being on 2022-01-01 and the latest listing 2022-08-14

Meath

There are 1939 observations in Meath, 760 are 3 beds

For discussion I am trying to convey the difficulty with the 350,000 cap in Meath for the First Home Scheme. I acknowledge the below is busy, I will attempt to break up the map into each electoral area, I cannot yet figure that out. - I have been able to do so for the ASP only. (See the appendix if interested)

Locations of the properties which the points represent if listing price is above or below the cap, is more challenging.

#Create Map 2
# add Y/N for if above 350,000
Daft_Meath_sf$Limit <- ifelse(Daft_Meath_sf$Listing_Price >= 350001,"Above","Below")

# plot
Daft_Meath_sf<- full_join(Daft_Meath_sf, ED_Tags, by = "ID")
Daft_Meath_sf<- rename(Daft_Meath_sf,EDNAME=geographic)

Map2<- ggplot()+
  geom_sf_text(data=Labs_EDMAPMEATH22,aes(label=EDNAME),color="black",alpha=0.9)+
  geom_sf(data=DaftSumE22Meath,aes(fill = Average_List),alpha=0.1,colour=alpha("gray",0.8))+
  scale_fill_steps2(midpoint = 350000,
    low="#71CCFF",
    mid="#FDF6F6",
    high="#BF0F06",
    labels = scales::comma,
    name = "ASP",
    breaks= c(200000,250000,300000,350000,400000,450000,500000))+
  geom_sf(data=Daft_Meath_sf,alpha=0.3,size=1.5,aes(group=Limit,shape=Limit,colour=Limit))+
  scale_color_manual(values=c('#C40000','#00959E'))+scale_shape_manual(values=c(16, 3))+
  theme_void()+
  labs(title="2022* - Average Listing Price",
         subtitle = "2022 to date, scales adjusted to reflect Shared Equity (FHS) caps")

# # Table
# Table_Map2 <- Daft_Meath_sf %>%
#   group_by(Area,L.Above350) %>%
#   summarise(Nr= n(),
#             Average_List_Price = mean(Listing_Price,na.rum=TRUE))

Map2

# Table_Map2<- Table_Map2 %>% drop_na(L.Above350)  
# Table_Map2%>%
#   kbl(caption = "Daft 'Area' - 2022 to date")%>%
#   kable_styling(bootstrap_options = c("striped", "hover", "condensed"), full_width = T)%>%
#   scroll_box(width = "800px", height = "300px")

######## 3 Bed
# Daft_Meath_sf.3bed$Limit <- ifelse(Daft_Meath_sf.3bed$Listing_Price >= 350001,"Above","Below")
# 
# # plot
# # Daft_Meath_sf.3bed<- full_join(Daft_Meath_sf.3bed, ED_Tags, by = "ID")
# # Daft_Meath_sf.3bed<- rename(Daft_Meath_sf.3bed,EDNAME=geographic)
# 
# Map3<-ggplot()+
#   geom_sf_text(data=Labs_EDMAPMEATH22,aes(label=EDNAME),color="black",alpha=0.9)+
#   geom_sf(data=DaftSumE22Meath.3bed,aes(fill = Average_List),alpha=0.1,colour=alpha("gray",0.8))+
#   scale_fill_steps2(midpoint = 350000,
#     low="#71CCFF",
#     mid="#FDF6F6",
#     high="#BF0F06",
#     labels = scales::comma,
#     name = "ASP",
#     breaks= c(200000,250000,300000,350000,400000,450000,500000))+
#   geom_sf(data=Daft_Meath_sf.3bed,alpha=0.3,size=1.5,aes(group=Limit,shape=Limit,colour=Limit))+
#   scale_color_manual(values=c('#C40000','#00959E'))+scale_shape_manual(values=c(16, 3))+
#   theme_void()+
#   labs(title="3 Beds: 2022* - Average Listing Price")
# 
# Map3

CSO Data

CPI

Headline & Summary

The headline inflation for August is 8.7%. This represents a -0.4 percentage change from July which was 9.1%.

colour_set <- ifelse(CPM01_1B$value < 0,"#CC0000","#007589")
FigCPM01_1B <- ggplot(data=CPM01_1B,aes(x=Date,y=value))+
  geom_col(fill= colour_set, alpha = 0.5)+
  labs(title = "CPI - CSO: CPM01", subtitle = "2020 to Date")+
  xlab("Year-Month")+
  ylab("Percentage Change over 12 months")+
  theme_bw()+
  theme(panel.border = element_rect(linetype = 1, fill = NA))+
  geom_text(data=CPM01_1B,aes(label = value, 
            vjust= ifelse(value >=0,0.25,0.5),
            hjust= ifelse(value >=0,-0.25,1)),
            size = 2, 
            angle = 90)
FigCPM01_1B

CPM01_2A_end <- CPM01_2A %>%
  group_by(Statistic)%>%
  slice(which.max(Date))
CPM01_2A_end$lab <- paste(as.character(CPM01_2A_end$Date), "-", comma(CPM01_2A_end$value,digits=0))

FigCPM01_2A<- ggplot(data=CPM01_2A,aes(x=Date,y=value))+
  geom_line(size = 1.15, linetype=1, alpha = 0.6, colour = "#946627")+
  geom_hline(aes(yintercept=100), 
             colour= "#404040",
             linetype = 1)+
  geom_text_repel(aes(label=lab),data=CPM01_2A_end,size=3)+
   labs(title = "CPI - CSO: CPM01", subtitle = "1997 to Date")+
  xlab("Year-Month")+
  ylab("Consumer Price Index (Base Dec 2016=100)")+theme_bw()+
  theme(panel.border = element_rect(linetype = 1, fill = NA))

FigCPM01_2A

Analysis / Trend

FigCPM01_2 <- ggplot(data=CPM01_2,aes(x=Date,y=value))+
  geom_line(size = 1.15, linetype=1, alpha = 0.6, colour = "#946627")+
  geom_hline(aes(yintercept=100), 
             colour= "#404040",
             linetype = 1)+
  theme_bw()+
  labs(title = "CPI - CSO: CPM01", subtitle = "2016 to Date")+
  xlab("Year-Month")+
  ylab("Consumer Price Index (Base Dec 2016=100)")+
  theme(panel.border = element_rect(linetype = 1, fill = NA))
FigCPM01_2

CPM03_2_end <- CPM03_2 %>%
  group_by(Statistic,Selected.Sub.Indices)%>%
  slice(which.max(Date))
CPM03_2_end$lab <- paste(as.character(CPM03_2_end$Date), "-", comma(CPM03_2_end$value,digits=0))

FigCPM03_2 <- ggplot(data=CPM03_2, aes(x=Date, y=value, group=Selected.Sub.Indices, colour=Selected.Sub.Indices))+
  scale_colour_manual(values=c("#0389bb", "#0c122f", "#88b66c"))+
  labs(title = "CPI - CSO: CPM03", subtitle = "2016 to Date, selected sub indicies")+
  xlab("Year-Month")+
  ylab("Consumer Price Index (Base Dec 2016=100)")+
  geom_line(size = 1.05, linetype=1, alpha = 0.6)+
  geom_hline(aes(yintercept=0), 
             colour= "#404040",
             linetype = 1)+
  geom_text_repel(aes(label=lab),data=CPM03_2_end,size=3)+
  theme_bw()+
  theme(axis.text.x = element_text(angle=0))+
  theme(legend.position="bottom")+
  theme(axis.text = element_text(size = rel(1)))+
  theme(plot.title=(element_text(vjust =2)))+
  theme(panel.border = element_rect(linetype = 1, fill = NA))

FigCPM03_2

FigCPM03_1 <- ggplot(data=CPM03_1, aes(x=Date, y=value, group=Selected.Sub.Indices, colour=Selected.Sub.Indices))+
  scale_colour_manual(values=c("#0389bb", "#0c122f", "#88b66c"))+
  labs(title = "CPI - CSO: CPM03", subtitle = "Historical Series, selected sub indicies")+
  xlab("Year-Month")+
  ylab("Percentage change year on year")+
  geom_line(size = 1.05, linetype=1, alpha = 0.85)+
  geom_hline(aes(yintercept=0), 
             colour= "#404040",
             linetype = 1)+theme_bw()+
  theme(axis.text.x = element_text(angle=0))+
  theme(legend.position="bottom")+
  theme(axis.text = element_text(size = rel(1)))+
  theme(plot.title=(element_text(vjust =2)))+
  theme(panel.border = element_rect(linetype = 1, fill = NA))

FigCPM03_1

Public Sector Affordability

Average public sector earnings included from the 2nd of September to generate heat maps of affordability. The colours represent what the mortgage rate for a given amount is relative to the combined earnings of public sector earnings.

# Load Public Sector Wages
EHQ10 <- cso_get_data("EHQ10")
EHQ10 <- EHQ10 %>%
  filter(Statistic=="Average Weekly Earnings") %>%
  filter(Sub.Sector != "Total Public Sector including Semi State bodies")%>%
  filter(Sub.Sector != "Total Public Sector excluding Semi State bodies")
EHQ10 <- EHQ10 %>%
  pivot_longer(!1:2,names_to = "year_qtr")

EHQ10$Year_Q <- as.yearqtr(EHQ10$year_qtr)
EHQ10$Year <- year(EHQ10$Year_Q)

## Filter for Q2 2022
EHQ10 <- EHQ10 %>%
  filter(year_qtr == "2022Q2")

## Data transformation to pair earnings
Pair <- EHQ10 %>%
  select(2,4)

Pair <- Pair %>%
  pivot_wider(names_from = Sub.Sector,values_from = value)
Pair$year_qtr <- "2022Q2"

EHQ10_Pair <- merge(x=EHQ10,y=Pair,by="year_qtr")
EHQ10_Pair <- EHQ10_Pair %>%
  rename(Wage1 = value)

Wages <- EHQ10_Pair %>%
  pivot_longer(!1:6,names_to = "Pair")
Wages <- Wages %>%
  rename(Wage2 = value)
Wages$Wages <- Wages$Wage1+Wages$Wage2

# Load Template for rates and mortgage brackets
MR <- read_excel("C:/Users/charten/OneDrive - Glenveagh Properties/Research & Development/1. Analysis/Template Rates and Mortgage.xlsx")

MR$year_qtr <- "2022Q2"

# Merge MR & Wages
Data <- merge(x=Wages,y=MR,by="year_qtr")
Data$Cost <- Data$`30_Yr`/(Data$Wages*4)

# Plot
## base plot
options(scipen=999)

Data$Rate2 <- Data$Rate*100 
Data$Cap <- ((Data$Wages*4)*12)*3.5 

Plot1<- ggplot(Data,aes(x=Mortgage,y=Rate2))+
  geom_raster(aes(fill=Cost))+
  scale_fill_stepsn(colours = c("cyan", "black", "red"),
                    n.breaks=9) +
  geom_vline(data=Data|>
               dplyr::group_by(Sub.Sector,Pair)|> dplyr::summarise(Cap=mean(Cap)),
             aes(xintercept=Cap),
             alpha=0.5,
             colour="#F5F9F9")+
  geom_vline(xintercept = 200000,linetype=1,alpha=0.2)+
  geom_vline(xintercept = 400000,linetype=1,alpha=0.2)+
  geom_vline(xintercept = 600000,linetype=1,alpha=0.2)+
  geom_vline(xintercept = 300000,linetype=2,alpha=0.2)+
  geom_vline(xintercept = 500000,linetype=2,alpha=0.2)+
  geom_vline(xintercept = 700000,linetype=2,alpha=0.2)+
  scale_x_continuous(limits = c(200000,750000), expand = c(0, 0)) +
  scale_y_continuous(limits = c(2.5,4.75), expand = c(0, 0)) +
  theme_bw()+
  xlab("Mortgage Amount (€)")+
  ylab("Mortgage Rate (%)")+ theme(axis.text.x = element_text(angle = 90, vjust = 0.5, hjust=1))+
  theme(legend.key.height= unit(1, 'cm'))+ 
  theme(strip.text.x = element_text(size = 7),strip.text.y = element_text(size = 7))+
  ggtitle("Public Sector Affordability - 30 Year Repayments as Percentage of Average Earnings")+
  labs(caption="lines drawn at 100k increments: dotted line drawn at 300k, 500k & 700k. White line indicate cap of 3.5 times income",fill="% of Earnings")+ theme(legend.title = element_text(size = 8))

Plot2<-Plot1+facet_grid(Sub.Sector~Pair,labeller = labeller(Pair = label_wrap_gen(width = 25),Sub.Sector = label_wrap_gen(width = 15)))

Plot2

Fuel Excise

## Fuel Excise Clearance
FPM01 <- cso_get_data("FPM01")
FPM01 <- FPM01 %>%
  pivot_longer(!1:2,names_to="year_month")
FPM01$Month <- as.Date(paste(FPM01$year_month, "01", sep = "-"), "%YM%m-%d")
FPM01$Year <- year(FPM01$Month)
##### moving average
###### 6 month
FPM01$SMA.6 <- round(SMA(FPM01$value,n=6),digits=2)
FPM01$SMA.6[FPM01$year_month=="2000M01" | FPM01$year_month=="2000M02" | FPM01$year_month=="2000M03"|FPM01$year_month=="2000M04" | FPM01$year_month=="2000M05"] <- NA
FPM01$SMA.12 <- round(SMA(FPM01$value,n=12),digits=2)
FPM01$SMA.12[FPM01$year_month=="2000M01" | FPM01$year_month=="2000M02" | FPM01$year_month=="2000M03"|FPM01$year_month=="2000M04" | FPM01$year_month=="2000M05"| FPM01$year_month=="2000M06" | FPM01$year_month=="2000M07"|FPM01$year_month=="2000M08" | FPM01$year_month=="2000M09"|FPM01$year_month=="2000M10" | FPM01$year_month=="2000M11"] <- NA

FPM01_end <- FPM01 %>%
  group_by(STATISTIC,Fuel.Type)%>%
  slice(which.max(Month))
FPM01_end$lab <- paste(as.character(FPM01_end$year_month), "-", comma(FPM01_end$SMA.12,digits=0))

FPM01_end_val <- FPM01_end$SMA.12
  
#### plot
Fig.FPM01.1<-ggplot(FPM01, aes(Month, SMA.12, group=Fuel.Type,colour=Fuel.Type,fill=Fuel.Type))+
  geom_area(alpha=0.5)+
  theme_bw()+
  geom_text_repel(aes(label=lab),data=FPM01_end,size=3,colour="black")+
  theme(legend.position = "bottom")+
  ggtitle("Fuel Excise Clearance")+
  ylab("million litres")+
  labs(subtitle = "12 month moving average")

Fig.FPM01.2<-ggplot(FPM01, aes(Month, SMA.12, group=Fuel.Type,colour=Fuel.Type,fill=Fuel.Type))+
  geom_line(alpha=0.9)+
  geom_line(data=FPM01, aes(x=Month, y=SMA.6, group=Fuel.Type,colour=Fuel.Type),alpha=0.4)+
  geom_line(data=FPM01, aes(x=Month, y=value, group=Fuel.Type),alpha=0.3,colour="gray")+
  geom_text_repel(aes(label=SMA.12),data=FPM01_end,size=2.25,colour="black",alpha=0.9,hjust=1)+
  #scale_y_continuous(sec.axis = sec_axis(~ ., breaks = FPM01_end$SMA.12))+
  theme_bw()+
  theme(legend.position = "none")+
  ggtitle("Fuel Excise Clearance")+
  ylab("million litres")+
  labs(subtitle = "12 month moving average",caption = "6 month moving average also included, monthly value shown in gray")

Fig.FPM01.1

Fig.FPM01.2 + facet_wrap(~Fuel.Type,ncol=2,nrow=2)

Vehicle Registrations

## Vehicles
### TEM12
TEM12 <- cso_get_data("TEM12")
TEM12 <- TEM12 %>%
  pivot_longer(!1:3,names_to="year_month")
TEM12$Month <- as.Date(paste(TEM12$year_month, "01", sep = "-"), "%YM%m-%d")
TEM12$Year <- year(TEM12$Month)

#### All Vehicles [(.).1], New Private Cars [(.).2]
TEM12.1 <- TEM12 %>%
  filter(Type.of.Vehicle.Registration=="All Vehicles")
TEM12.1$SMA.6 <- round(SMA(TEM12.1$value,n=6),digits=2)
TEM12.1$SMA.6[TEM12.1$year_month=="2015M01" | TEM12.1$year_month=="2015M02" | TEM12.1$year_month=="2015M03"|TEM12.1$year_month=="2015M04" | TEM12.1$year_month=="2015M05"] <- NA
TEM12.1$SMA.12 <- round(SMA(TEM12.1$value,n=12),digits=2)
TEM12.1$SMA.12[TEM12.1$year_month=="2015M01" | TEM12.1$year_month=="2015M02" | TEM12.1$year_month=="2015M03"|TEM12.1$year_month=="2015M04" | TEM12.1$year_month=="2015M05"| TEM12.1$year_month=="2015M06" | TEM12.1$year_month=="2015M07"|TEM12.1$year_month=="2015M08" |TEM12.1$year_month=="2015M09"|TEM12.1$year_month=="2015M10" | TEM12.1$year_month=="2015M11"] <- NA

TEM12.2 <- TEM12 %>%
  filter(Type.of.Vehicle.Registration=="New Private Cars")
TEM12.2$SMA.6 <- round(SMA(TEM12.2$value,n=6),digits=2)
TEM12.2$SMA.6[TEM12.2$year_month=="2015M01" | TEM12.2$year_month=="2015M02" | TEM12.2$year_month=="2015M03"|TEM12.2$year_month=="2015M04" | TEM12.2$year_month=="2015M05"] <- NA
TEM12.2$SMA.12 <- round(SMA(TEM12.2$value,n=12),digits=2)
TEM12.2$SMA.12[TEM12.2$year_month=="2015M01" | TEM12.2$year_month=="2015M02" | TEM12.2$year_month=="2015M03"|TEM12.2$year_month=="2015M04" | TEM12.2$year_month=="2015M05"| TEM12.2$year_month=="2015M06" | TEM12.2$year_month=="2015M07"|TEM12.2$year_month=="2015M08" |TEM12.2$year_month=="2015M09"|TEM12.2$year_month=="2015M10" | TEM12.2$year_month=="2015M11"] <- NA

#### All fuel types [(..).1], Petrol [(..).2], Diesel [(..).3], Electric [(..).4]
TEM12.1.1 <- TEM12.1 %>%
  filter(Type.of.Fuel=="All fuel types")
TEM12.1.2 <- TEM12.1 %>%
  filter(Type.of.Fuel=="Petrol")
TEM12.1.3 <- TEM12.1 %>%
  filter(Type.of.Fuel=="Diesel")
TEM12.1.4 <- TEM12.1 %>%
  filter(Type.of.Fuel=="Electric")

TEM12.2.1 <- TEM12.2 %>%
  filter(Type.of.Fuel=="All fuel types")
TEM12.2.2 <- TEM12.2 %>%
  filter(Type.of.Fuel=="Petrol")
TEM12.2.3 <- TEM12.2 %>%
  filter(Type.of.Fuel=="Diesel")
TEM12.2.4 <- TEM12.2 %>%
  filter(Type.of.Fuel=="Electric")

##### Detailed Plots
###### Petrol
  # ggplot()+
  # geom_line(data=TEM12.1.2,aes(x=Month,y=SMA.12),colour="darkred",size=1.25)+
  # geom_line(data=TEM12.2.2,aes(x=Month,y=SMA.12),colour="navy",size=1.25)+  
  # geom_line(data=TEM12.1.2,aes(x=Month,y=SMA.6),colour="darkred",alpha=0.5)+
  # geom_line(data=TEM12.2.2,aes(x=Month,y=SMA.6),colour="navy",alpha=0.5)+  
  # theme_bw()+
  # ggtitle("New Licensed Vehicles - Petrol")+
  # ylab("number")+
  # labs(caption="red = All Vehicles, navy = Private Cars. (6 month MA included)", subtitle = "12 month moving average")

Fig.TEM12_P1<-ggplot()+
  geom_line(data=TEM12.1.2[which(TEM12.1.2$Month>="2016-01-01"),],aes(x=Month,y=SMA.12),colour="darkred",size=1.25,alpha=0.6)+
  geom_line(data=TEM12.2.2[which(TEM12.2.2$Month>="2016-01-01"),],aes(x=Month,y=SMA.12),colour="navy",size=1.25,alpha=0.6)+  
  geom_line(data=TEM12.1.2[which(TEM12.1.2$Month>="2016-01-01"),],aes(x=Month,y=SMA.6),colour="gray",alpha=0.5)+
  geom_line(data=TEM12.2.2[which(TEM12.2.2$Month>="2016-01-01"),],aes(x=Month,y=SMA.6),colour="gray",alpha=0.5)+  
  geom_text_repel(aes(x=Month,y=SMA.12,label=SMA.12),data=TEM12.1.2[which(TEM12.1.2$Month>="2016-01-01"),],max.overlaps = 2,size=3)+
  geom_text_repel(aes(x=Month,y=SMA.12,label=SMA.12),data=TEM12.2.2[which(TEM12.2.2$Month>="2016-01-01"),],max.overlaps = 2,size=3)+
  theme_bw()+
  ggtitle("New Licensed Vehicles - Petrol")+
  ylab("number")+
  labs(caption="red = All Vehicles, navy = Private Cars. (6 month MA included)", subtitle = "12 month moving average")

Fig.TEM12_D1<-ggplot()+
  geom_line(data=TEM12.1.3[which(TEM12.1.3$Month>="2016-01-01"),],aes(x=Month,y=SMA.12),colour="darkred",size=1.25,alpha=0.6)+
  geom_line(data=TEM12.2.3[which(TEM12.2.3$Month>="2016-01-01"),],aes(x=Month,y=SMA.12),colour="navy",size=1.25,alpha=0.6)+  
  geom_line(data=TEM12.1.3[which(TEM12.1.3$Month>="2016-01-01"),],aes(x=Month,y=SMA.6),colour="gray",alpha=0.5)+
  geom_line(data=TEM12.2.3[which(TEM12.2.3$Month>="2016-01-01"),],aes(x=Month,y=SMA.6),colour="gray",alpha=0.5)+  
  geom_text_repel(aes(x=Month,y=SMA.12,label=SMA.12),data=TEM12.1.3[which(TEM12.1.3$Month>="2016-01-01"),],max.overlaps = 4,size=3)+
  geom_text_repel(aes(x=Month,y=SMA.12,label=SMA.12),data=TEM12.2.3[which(TEM12.2.3$Month>="2016-01-01"),],max.overlaps = 4,size=3)+
  theme_bw()+
  ggtitle("New Licensed Vehicles - Diesel")+
  ylab("number")+
  labs(caption="red = All Vehicles, navy = Private Cars. (6 month MA included)", subtitle = "12 month moving average")

Fig.TEM12_E1<-ggplot()+
  geom_line(data=TEM12.1.4[which(TEM12.1.4$Month>="2016-01-01"),],aes(x=Month,y=SMA.12),colour="darkred",size=1.25,alpha=0.6)+
  geom_line(data=TEM12.2.4[which(TEM12.2.4$Month>="2016-01-01"),],aes(x=Month,y=SMA.12),colour="navy",size=1.25,alpha=0.6)+  
  geom_line(data=TEM12.1.4[which(TEM12.1.4$Month>="2016-01-01"),],aes(x=Month,y=SMA.6),colour="gray",alpha=0.5)+
  geom_line(data=TEM12.2.4[which(TEM12.2.4$Month>="2016-01-01"),],aes(x=Month,y=SMA.6),colour="gray",alpha=0.5)+  
  geom_text_repel(aes(x=Month,y=SMA.12,label=SMA.12),data=TEM12.1.4[which(TEM12.1.4$Month>="2016-01-01"),],max.overlaps = 1,size=3)+
  geom_text_repel(aes(x=Month,y=SMA.12,label=SMA.12),data=TEM12.2.4[which(TEM12.2.4$Month>="2016-01-01"),],max.overlaps = 1,size=3)+
  theme_bw()+
  ggtitle("New Licensed Vehicles - Electric")+
  ylab("number")+
  labs(caption="red = All Vehicles, navy = Private Cars. (6 month MA included)", subtitle = "12 month moving average")

######## run facets for graphs above
Fig.TEM12_P1.A<-ggplot()+
  geom_line(data=TEM12.1.2[which(TEM12.1.2$Month>="2016-01-01"),],aes(x=Month,y=SMA.12),colour="darkred",size=1.25,alpha=0.6)+
  geom_line(data=TEM12.2.2[which(TEM12.2.2$Month>="2016-01-01"),],aes(x=Month,y=SMA.12),colour="navy",size=1.25,alpha=0.6)+  
  geom_line(data=TEM12.1.2[which(TEM12.1.2$Month>="2016-01-01"),],aes(x=Month,y=SMA.6),colour="gray",alpha=0.5)+
  geom_line(data=TEM12.2.2[which(TEM12.2.2$Month>="2016-01-01"),],aes(x=Month,y=SMA.6),colour="gray",alpha=0.5)+  
  geom_text_repel(aes(x=Month,y=SMA.12,label=SMA.12),data=TEM12.1.2[which(TEM12.1.2$Month>="2016-01-01"),],max.overlaps = 8,size=2.5)+
  geom_text_repel(aes(x=Month,y=SMA.12,label=SMA.12),data=TEM12.2.2[which(TEM12.2.2$Month>="2016-01-01"),],max.overlaps = 8,size=2.5)+
  theme_bw()+
  ggtitle("New Licensed Vehicles - 12 month moving average")+
  ylab("number")+
  xlab(NULL)+
  labs(subtitle = "Petrol")

Fig.TEM12_D1.A<-ggplot()+
  geom_line(data=TEM12.1.3[which(TEM12.1.3$Month>="2016-01-01"),],aes(x=Month,y=SMA.12),colour="darkred",size=1.25,alpha=0.6)+
  geom_line(data=TEM12.2.3[which(TEM12.2.3$Month>="2016-01-01"),],aes(x=Month,y=SMA.12),colour="navy",size=1.25,alpha=0.6)+  
  geom_line(data=TEM12.1.3[which(TEM12.1.3$Month>="2016-01-01"),],aes(x=Month,y=SMA.6),colour="gray",alpha=0.5)+
  geom_line(data=TEM12.2.3[which(TEM12.2.3$Month>="2016-01-01"),],aes(x=Month,y=SMA.6),colour="gray",alpha=0.5)+  
  geom_text_repel(aes(x=Month,y=SMA.12,label=SMA.12),data=TEM12.1.3[which(TEM12.1.3$Month>="2016-01-01"),],max.overlaps = 6,size=2.5)+
  geom_text_repel(aes(x=Month,y=SMA.12,label=SMA.12),data=TEM12.2.3[which(TEM12.2.3$Month>="2016-01-01"),],max.overlaps = 6,size=2.5)+
  theme_bw()+
  ylab("number")+xlab(NULL)+
  labs(subtitle = "Diesel")

Fig.TEM12_E1.A<-ggplot()+
  geom_line(data=TEM12.1.4[which(TEM12.1.4$Month>="2016-01-01"),],aes(x=Month,y=SMA.12),colour="darkred",size=1.25,alpha=0.6)+
  geom_line(data=TEM12.2.4[which(TEM12.2.4$Month>="2016-01-01"),],aes(x=Month,y=SMA.12),colour="navy",size=1.25,alpha=0.6)+  
  geom_line(data=TEM12.1.4[which(TEM12.1.4$Month>="2016-01-01"),],aes(x=Month,y=SMA.6),colour="gray",alpha=0.5)+
  geom_line(data=TEM12.2.4[which(TEM12.2.4$Month>="2016-01-01"),],aes(x=Month,y=SMA.6),colour="gray",alpha=0.5)+  
  geom_text_repel(aes(x=Month,y=SMA.12,label=SMA.12),data=TEM12.1.4[which(TEM12.1.4$Month>="2016-01-01"),],max.overlaps = 6,size=2.5)+
  geom_text_repel(aes(x=Month,y=SMA.12,label=SMA.12),data=TEM12.2.4[which(TEM12.2.4$Month>="2016-01-01"),],max.overlaps = 6,size=2.5)+
  theme_bw()+
  ylab("number")+
  labs(caption="red = All Vehicles, navy = Private Cars. (6 month MA included)", subtitle = "Electric")

Fig.TEM12_A <- Fig.TEM12_P1.A + Fig.TEM12_D1.A + Fig.TEM12_E1.A + plot_layout(nrow=2,ncol = 2)
Fig.TEM12_A

### TEM02
TEM02 <- cso_get_data("TEM02")
TEM02 <- TEM02 %>%
  pivot_longer(!1:2,names_to="year_month")
TEM02$value <- as.integer(TEM02$value)
TEM02$year_month[TEM02$year_month=="2021m02"] <- "2021M02"
TEM02$Month <- as.Date(paste(TEM02$year_month, "01", sep = "-"), "%YM%m-%d")
TEM02$Year <- year(TEM02$Month)

#### Secondhand Private Cars [(.).1], New Private Cars [(.).2]
TEM02.1 <- TEM02 %>%
  filter(Type.of.Vehicle.Registration=="Secondhand Private Cars")
TEM02.1$SMA.6 <- round(SMA(TEM02.1$value,n=6),digits=2)
TEM02.1$SMA.6[TEM02.1$year_month=="1965M01" | TEM02.1$year_month=="1965M02" | TEM02.1$year_month=="1965M03"|TEM02.1$year_month=="1965M04" | TEM02.1$year_month=="1965M05"] <- NA
TEM02.1$SMA.12 <- round(SMA(TEM02.1$value,n=12),digits=2)
TEM02.1$SMA.12[TEM02.1$year_month=="1965M01" | TEM02.1$year_month=="1965M02" | TEM02.1$year_month=="1965M03"|TEM02.1$year_month=="1965M04" | TEM02.1$year_month=="1965M05"| TEM02.1$year_month=="1965M06" | TEM02.1$year_month=="1965M07"|TEM02.1$year_month=="1965M08" |TEM02.1$year_month=="1965M09"|TEM02.1$year_month=="1965M10" | TEM02.1$year_month=="1965M11"] <- NA

TEM02.2 <- TEM02 %>%
  filter(Type.of.Vehicle.Registration=="New Private Cars")
TEM02.2$SMA.6 <- round(SMA(TEM02.2$value,n=6),digits=2)
TEM02.2$SMA.6[TEM02.2$year_month=="1965M01" | TEM02.2$year_month=="1965M02" | TEM02.2$year_month=="1965M03"|TEM02.2$year_month=="1965M04" | TEM02.2$year_month=="1965M05"] <- NA
TEM02.2$SMA.12 <- round(SMA(TEM02.2$value,n=12),digits=2)
TEM02.2$SMA.12[TEM02.2$year_month=="1965M01" | TEM02.2$year_month=="1965M02" | TEM02.2$year_month=="1965M03"|TEM02.2$year_month=="1965M04" | TEM02.2$year_month=="1965M05"| TEM02.2$year_month=="1965M06" | TEM02.2$year_month=="1965M07"|TEM02.2$year_month=="1965M08" |TEM02.2$year_month=="1965M09"|TEM02.2$year_month=="1965M10" | TEM02.2$year_month=="1965M11"] <- NA

TEM02.A <-  rbind(TEM02.1,TEM02.2)
TEM02.A_end <- TEM02.A %>%
  group_by(STATISTIC,Type.of.Vehicle.Registration)%>%
  slice(which.max(Month))

Fig1.TEM02<- ggplot(TEM02.A,aes(x=Month,y=SMA.12,group=Type.of.Vehicle.Registration,colour=Type.of.Vehicle.Registration))+
  geom_line(size=1.25,alpha=0.6)+
  scale_colour_manual(values = c("navy","purple"))+
  geom_text_repel(aes(x=Month,y=SMA.12,label=SMA.12),data=TEM02.A,max.overlaps = 12,size=2.75,colour="black")+
  theme_bw()+
  theme(legend.position = "bottom")+
  ggtitle("Vehicles Licensed for the First Time")+
  ylab("number")+
  labs(subtitle = "TEM02: 12 month moving average")

Fig2.TEM02<-ggplot(TEM02.A,aes(x=Month,y=SMA.6,group=Type.of.Vehicle.Registration,colour=Type.of.Vehicle.Registration))+
  geom_line(size=1.25,alpha=0.6)+
  scale_colour_manual(values = c("navy","purple"))+
  geom_text_repel(aes(x=Month,y=SMA.6,label=SMA.6),data=TEM02.A,max.overlaps = 9,size=2.75,colour="black")+
  theme_bw()+
  theme(legend.position = "bottom")+
  ggtitle("Vehicles Licensed for the First Time")+
  ylab("number")+
  labs(subtitle = "TEM02: 6 month moving average")

Fig1.TEM02 + scale_y_continuous(sec.axis = sec_axis(~ ., breaks = TEM02.A_end$SMA.12))

  #facet_wrap(~Type.of.Vehicle.Registration,nrow=2)

Building & Construction

## Indices of Total Production in Building and Construction Sector (Base 2015=100)
BEQ04 <- cso_get_data("BEQ04")
BEQ04 <- BEQ04 %>%
  pivot_longer(!1:2,names_to="year_qtr")
BEQ04$Year_Q <- as.yearqtr(BEQ04$year_qtr)
BEQ04$Year <- year(BEQ04$Year_Q)
##### generate lags and percentage change
BEQ04$Lag <- Lag(BEQ04$value,1)
BEQ04$Lag[BEQ04$year_qtr=="2000Q1"]<- NA
BEQ04$Diff<- BEQ04$value-BEQ04$Lag 
BEQ04$Diffpc<- ((BEQ04$value-BEQ04$Lag)/BEQ04$Lag)*100
BEQ04$Diffpc<- round(BEQ04$Diffpc,digits=2)

### subset value [(.).A] & volume [(.).B]
BEQ04.A <- BEQ04 %>%
  filter(Statistic=="Value of Production Index in Building and Construction (Seasonally Adjusted)")
BEQ04.B <- BEQ04 %>%
  filter(Statistic=="Volume of Production Index in Building and Construction (Seasonally Adjusted)")
##### generate lags and percentage change
# BEQ04.A$Lag <- Lag(BEQ04.A$value,1)
# BEQ04.A$Lag[BEQ04.A$year_qtr=="2000Q1"]<- NA
# BEQ04.A$Diff<- BEQ04.A$value-BEQ04.A$Lag 
# BEQ04.A$Diffpc<- ((BEQ04.A$value-BEQ04.A$Lag)/BEQ04.A$Lag)*100
# BEQ04.A$Diffpc<- round(BEQ04.A$Diffpc,digits=2)
# 
# BEQ04.B$Lag <- Lag(BEQ04.B$value,1)
# BEQ04.B$Lag[BEQ04.B$year_qtr=="2000Q1"]<- NA
# BEQ04.B$Diff<- BEQ04.B$value-BEQ04.B$Lag 
# BEQ04.B$Diffpc<- ((BEQ04.B$value-BEQ04.B$Lag)/BEQ04.B$Lag)*100
# BEQ04.B$Diffpc<- round(BEQ04.B$Diffpc,digits=2)

### seasonally adjusted [(.)_S]
BEQ04_S <- BEQ04 %>%
  filter(Statistic=="Value of Production Index in Building and Construction (Seasonally Adjusted)"|Statistic=="Volume of Production Index in Building and Construction (Seasonally Adjusted)")

Fig1.BEQ04<- ggplot(BEQ04_S,aes(x=Year_Q,y=value,group=Statistic,colour=Statistic))+
  geom_line()+
  theme_bw()+
  geom_hline(yintercept = 100,colour="black")+
  theme(legend.position = "bottom")+
  ggtitle("Indices of Total Production in Building and Construction Sector")+
  ylab("(2015 = 100)")

#Fig1.BEQ04 + facet_wrap(~Type.of.Building.and.Construction,nrow=5)

### subset from 2015
BEQ04_S.15 <- BEQ04_S %>%
  filter(Year_Q >= "2015 Q1")

Fig2.BEQ04<-ggplot(BEQ04_S.15,aes(x=Year_Q,y=value,group=Statistic,colour=Statistic))+
  geom_line(size=1.25,alpha=0.6)+
  theme_bw()+
  geom_hline(yintercept = 100,colour="black",alpha=0.4,linetype=2)+
  geom_text_repel(aes(x=Year_Q,y=value,label=round(value,digits = 1)),data=BEQ04_S.15,max.overlaps = 6,size=2.75,colour="black")+
  theme(legend.position = "none")+
  ggtitle("Indices of Total Production in Building and Construction Sector")+
  ylab("(2015 = 100)")+
  labs(subtitle = "Orange = Value Index, Blue = Volume Index")

Fig2.BEQ04 + facet_wrap(~Type.of.Building.and.Construction,nrow=3,ncol=2)

#### subset for Residential
BEQ04_S.15.Res<- BEQ04_S.15%>%
  filter(Type.of.Building.and.Construction =="Residential building")

Fig3.BEQ04 <- ggplot(BEQ04_S.15.Res,aes(x=Year_Q,y=Diffpc,group=Statistic,colour=Statistic,fill=Statistic))+
  geom_col(size=1.25,alpha=0.6)+
  geom_text_repel(aes(x=Year_Q,y=Diffpc,label=Diffpc),data=BEQ04_S.15.Res,colour="black",max.overlaps = 5,size=3)+
  theme_bw()+
  theme(legend.position = "bottom")+
  ylab("% change, q on q")

Fig3.BEQ04 + facet_wrap(~Statistic,ncol=2)

Wholesale Price Index

Year on year percentage change

colour <-ifelse(WPM28_B$value < 0,"#CC0000","#1b5545")

Fig1<-ggplot(WPM28_B, aes(x=Date, y=value, group=Type.of.Material))+
  geom_col(aes(group=Type.of.Material), alpha = 0.65, colour="#373634", fill = colour)+
  labs(title = "Percentage Change over 12 month in Wholesale Price Index")+
  xlab("Year-Month")+
  ylab("Percentage change")+
   # scale_x_date(date_labels="%b-%Y",date_breaks  ="3 month")+
  geom_text_repel(aes(label=value),data = WPM28_B, size = 3)+
  theme_bw()+
  theme(axis.text.x = element_text(angle=90))+
  theme(axis.text.x=element_text(size=10))+
  theme(legend.position="none")+
  theme(axis.text = element_text(size = rel(1)))+
  theme(plot.title=(element_text(vjust =2)))+
  theme(panel.border = element_rect(linetype = 1, fill = NA))

Fig1 + facet_wrap(~Type.of.Material, ncol = 3)

Wholesale Price Index

Black line (100) indicates 2015 as baseline

Fig2<-ggplot(WPM28_A, aes(x=Date, y=value, group=Type.of.Material, colour=Type.of.Material))+
  geom_line(aes(group=Type.of.Material),size = 1.05, linetype=1, alpha = 0.65)+geom_text_repel(aes(label=value),data = WPM28_A, size = 3)+
  labs(title = "Percentage Change over 12 month in Wholesale Price Index")+
  xlab("Year-Month")+
  ylab("2015 = 100")+
  geom_hline(aes(yintercept=100), 
             colour= "#404040",
             linetype = 1)+
   # scale_x_date(date_labels="%b-%Y",date_breaks  ="3 month")+
  theme_bw()+
  theme(axis.text.x = element_text(angle=90))+
  theme(axis.text.x=element_text(size=10))+
  theme(legend.position="none")+
  theme(axis.text = element_text(size = rel(1)))+
  theme(plot.title=(element_text(vjust =2)))+
  theme(panel.border = element_rect(linetype = 1, fill = NA))

Fig2 + facet_wrap(~Type.of.Material, ncol = 3)


Appendix

Meath ASP by ED

#Map3 <- 
DaftSumE22Meath %>%
  ggplot()+
  #geom_sf_text(aes(label=Average_List),color="black",alpha=0.9)+
  geom_sf(aes(fill = Average_List),alpha=0.9,colour=alpha("gray",0.8))+
  scale_fill_steps2(midpoint = 350000,
    low="#71CCFF",
    mid="#FDF6F6",
    high="#BF0F06",
    labels = scales::comma,
    name = "ASP",
    breaks= c(200000,250000,300000,350000,400000,450000,500000))+
  theme_void()+
  labs(title="2022* - Average Listing Price",
         subtitle = "2022 to date, scales adjusted to reflect Shared Equity (FHS) caps")+ facet_wrap(~EDNAME,ncol=3)

#Map3 <- + facet_wrap(~EDNAME,ncol=4)