I’ve added a bonus 5th scenario - with the MRP slope doubled. Pull this up alongside the other stochastic scenario vis.
MRP10YrCST <- read.csv("C:/Users/15733/Documents/Practicum II/Generator output - MRP slope/UST_10y format.csv")
MRP10YrCST <- melt(MRP10YrCST,value.name = "Interest_Rate",id.vars = "Month",variable.name = "Scenario")
MRP10YrCSTsubset <- MRP10YrCST[1:3610,]
summary(MRP10YrCST[,3])
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 0.00771 0.01919 0.02385 0.02572 0.03009 0.19187
sd(MRP10YrCST[,3])
## [1] 0.009281427
SummaryMRP10YrCST <- MRP10YrCST %>%
select(Scenario,Interest_Rate) %>%
group_by(Scenario) %>%
summarise(Avg_IntRate = mean(Interest_Rate), Standard_Deviation = sd(Interest_Rate))
print("MRP Speed doubled Summary")
## [1] "MRP Speed doubled Summary"
summary(SummaryMRP10YrCST[,2:3])
## Avg_IntRate Standard_Deviation
## Min. :0.01299 Min. :0.001409
## 1st Qu.:0.02177 1st Qu.:0.004148
## Median :0.02498 Median :0.005686
## Mean :0.02572 Mean :0.006505
## 3rd Qu.:0.02888 3rd Qu.:0.007933
## Max. :0.06925 Max. :0.047339
s <-ggplot(MRP10YrCSTsubset, aes(x=Month, y=Interest_Rate))+
geom_line(aes(color=Scenario), size=0.2) +
xlab("Month") + #ylab("Interest Rate") +
scale_y_continuous(name="Interest Rate", labels = scales::percent, limits = c(0, 0.15)) +
ggtitle("MRP Speed increasing") +
theme(legend.position = "none")
ggplotly(s)
MRP3mCST <- read.csv("C:/Users/15733/Documents/Practicum II/Generator output - MRP slope/UST_3m format.csv")
MRP3mCST <- melt(MRP3mCST,value.name = "Interest_Rate",id.vars = "Month",variable.name = "Scenario")
MRP6mCST <- read.csv("C:/Users/15733/Documents/Practicum II/Generator output - MRP slope/UST_6m format.csv")
MRP6mCST <- melt(MRP6mCST,value.name = "Interest_Rate",id.vars = "Month",variable.name = "Scenario")
MRP1YrCST <- read.csv("C:/Users/15733/Documents/Practicum II/Generator output - MRP slope/UST_1Y format.csv")
MRP1YrCST <- melt(MRP1YrCST,value.name = "Interest_Rate",id.vars = "Month",variable.name = "Scenario")
MRP2YrCST <- read.csv("C:/Users/15733/Documents/Practicum II/Generator output - MRP slope/UST_2Y format.csv")
MRP2YrCST <- melt(MRP2YrCST,value.name = "Interest_Rate",id.vars = "Month",variable.name = "Scenario")
MRP3YrCST <- read.csv("C:/Users/15733/Documents/Practicum II/Generator output - MRP slope/UST_3Y format.csv")
MRP3YrCST <- melt(MRP3YrCST,value.name = "Interest_Rate",id.vars = "Month",variable.name = "Scenario")
MRP5YrCST <- read.csv("C:/Users/15733/Documents/Practicum II/Generator output - MRP slope/UST_5Y format.csv")
MRP5YrCST <- melt(MRP5YrCST,value.name = "Interest_Rate",id.vars = "Month",variable.name = "Scenario")
MRP7YrCST <- read.csv("C:/Users/15733/Documents/Practicum II/Generator output - MRP slope/UST_7Y format.csv")
MRP7YrCST <- melt(MRP7YrCST,value.name = "Interest_Rate",id.vars = "Month",variable.name = "Scenario")
#Already imported 10
MRP20YrCST <- read.csv("C:/Users/15733/Documents/Practicum II/Generator output - MRP slope/UST_20Y format.csv")
MRP20YrCST <- melt(MRP20YrCST,value.name = "Interest_Rate",id.vars = "Month",variable.name = "Scenario")
MRP30YrCST <- read.csv("C:/Users/15733/Documents/Practicum II/Generator output - MRP slope/UST_30Y format.csv")
MRP30YrCST <- melt(MRP30YrCST,value.name = "Interest_Rate",id.vars = "Month",variable.name = "Scenario")
Then create data frame
xaxis <-matrix(c(0.25, 0.5, 1, 2, 3, 5, 7, 10, 20, 30))
colnames(xaxis) <- c('Tenor')
xaxis = as.data.frame(xaxis)
x<-1
month1 <-matrix(c(x, x, x, x, x, x, x, x, x, x))
colnames(month1) <- c('Month')
month1 = as.data.frame(month1)
MRPScen1Month1Curve <-matrix(c(MRP3mCST[1,3],
MRP6mCST[1,3],
MRP1YrCST[1,3],
MRP2YrCST[1,3],
MRP3YrCST[1,3],
MRP5YrCST[1,3],
MRP7YrCST[1,3],
MRP10YrCST[1,3],
MRP20YrCST[1,3],
MRP30YrCST[1,3]))
colnames(MRPScen1Month1Curve) <- c('Rate')
rownames(MRPScen1Month1Curve) <- c('3Mo',
'6Mo',
'1Yr',
'2Yr',
'3Yr',
'5Yr',
'7Yr',
'10Yr',
'20Yr',
'30Yr')
MRPScen1Month1Curve = as.data.frame(MRPScen1Month1Curve)
MRPScen1Month1Curve <- cbind.data.frame(month1,MRPScen1Month1Curve,xaxis)
x = 360
month360 <-matrix(c(x, x, x, x, x, x, x, x, x, x))
colnames(month360) <- c('Month')
month360 = as.data.frame(month360)
MRPScen1Month360Curve <-matrix(c(MRP3mCST[x,3],
MRP6mCST[x,3],
MRP1YrCST[x,3],
MRP2YrCST[x,3],
MRP3YrCST[x,3],
MRP5YrCST[x,3],
MRP7YrCST[x,3],
MRP10YrCST[x,3],
MRP20YrCST[x,3],
MRP30YrCST[x,3]))
colnames(MRPScen1Month360Curve) <- c('Rate')
MRPScen1Month360Curve <- cbind.data.frame(month360,MRPScen1Month360Curve,xaxis)
MRPCombo <- rbind(MRPScen1Month1Curve, MRPScen1Month360Curve)
Visualize MRP Scenario 1 Months 1 & 360 - curve shape
t <-ggplot(MRPCombo, aes(x=Tenor, y=Rate))+
geom_line(aes(color=Month), size=0.2) +
xlab("Tenor") +
scale_y_continuous(name="Interest Rate", labels = scales::percent, limits = c(0, 0.1)) +
ggtitle("Scenario 1 Interest Rate Curves, MRP slope increasing") +
theme(legend.position = "none")
ggplotly(t)