ST226 MT 2021 Mock Project Solution
Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit
ST226 MT 2021 Mock Project Solution
Question 1. The Net Present Value
The net cash flow per month (inflow minus outflow) is:
mthly_net <- rep(75000-45000, times = 120)
The computation of NPV is standard. The only catch the candidate should pay attention to is that we are
working with effective instead of nominal interest rate:
NPV <- -2e06 +sum(mthly_net*(1 + 0.03)ˆ{-(1:120)/12})
For part b, we need to first adjust the operational cost to reflect inflation. Note that monthly revenue is not
adjusted.
inflationAdjustment <- rep(1.02ˆ{0:9},each = 12)
mthly_net <- 75000 - inflationAdjustment*45000
Above, I’ve used R’s vectorization to trim down the equation. You can equally well use the following code: mthly_net <- rep(75000, times = 120) - inflationAdjustment*rep(45000, times = 120)
The revised NPV is now:
NPV_revised <- -2e06 +sum(mthly_net*(1 + 0.03)ˆ{-(1:120)/12})
The equation of value is:
≠2 ◊ 106 +ÿ(120)Xj ◊ (1 + i)≠j/12 = 0.
j=1
We can implement this in R and seach for its zero, as follows:
eqn_val <- function(i, ini, cashFlow){
-ini + sum(cashFlow*(1 + i)ˆ{-seq_along(cashFlow)/12})
}
uniroot(eqn_val, lower = 0, upper = 1, ini = 2e06, cashFlow = mthly_net)
## $root
## [1] 0.1055803
##
## $f.root
## [1] -2.669638
##
## $iter
## [1] 6
##
## $init.it
## [1] NA
##
## $estim.prec
## [1] 6.103516e-05
If you are nervous about writing a function of multiple arguments, this can work:
eqn_val <- function(j){
inflationAdjustment <- rep(1.02ˆ{0:9},each = 12)
mthly_net <- 75000 - inflationAdjustment*45000
-2e06 + mthly_net*(1 + i)ˆ{-seq_along(mthly_net)/12}
}
You can even rely on lexical scoping to do the job for you. You really should not, though.
eqn_val <- function(i){
-2e06 + mthly_net*(1 + i)ˆ{-seq_along(mthly_net)/12}
}
Question 2.
Note that the inflation adjustment vector has been defined above and has not changed since. mthly_net_B <- c(rep(0,times=2*12),rep(110000,times=8*12)) - inflationAdjustment*45000 NPV_B <- -2e06 +sum(mthly_net_B*(1 + 0.03)ˆ{-(1:120)/12})
The calculation of the rate of return is very similar to part a. This is because we have written eqn_val in a way that makes it reusable.
uniroot(eqn_val, lower = 0, upper = 1, ini = 2750000, cashFlow = mthly_net_B)
## $root
## [1] 0.07608493
##
## $f.root
## [1] -44.77227
##
## $iter
## [1] 7
##
## $init.it
## [1] NA
##
## $estim.prec
## [1] 6.103516e-05
We can recycle the equation of value in Question 1 for this.
i <- seq(from = 0, to = 0.2, by = 0.01)
NPV_sequence_A <- sapply(i, eqn_val, ini = 2e06, cashFlow = mthly_net)
NPV_sequence_B <- sapply(i, eqn_val, ini = 2750000, cashFlow = mthly_net_B)
plot(
x = i,
y = NPV_sequence_A,
xlab = "Effective Interest Rate",
ylab = "Net Present Value",
col = "red",
type = "l",
lty = 1
)
points(x = i, y = NPV_sequence_B, col = "blue", type = "l", lty = 2)
legend(
"topleft",
legend=c("Strat. A", "Strat. B"),
col=c("red", "blue"),
lty=1:2,
cex=0.8
)
0.00 0.05 0.10 0.15 0.20
Effective Interest Rate
Strategy B has heavier overhead and its profits are delayed. Income in the far future is punished more heavily
by discounting.
Question 3.
This is a standard amortisation scheme (output is omitted for brevity):
payment <- mthly_net
outstanding <- intPart <- capPart <- balance <- retained <- rep(0,length(payment))
for(j in 1:length(payment)){
outstanding[j] <- ifelse(j==1, 2e06*0.70, balance[j-1])
intPart[j] <- ((1 + 0.025)ˆ{1/12} - 1)*outstanding[j]
capPart[j] <- payment[j] - intPart[j]
balance[j] <- outstanding[j]- capPart[j]
if(balance[j] < 0){
retained[j] <- abs(balance[j])
balance[j] <- 0
if(j < length(payment)){
retained[(j+1):length(payment)] <- payment[(j+1):length(payment)]
}
break
}
}
loanSchedule <-
data.frame(payment,outstanding,intPart,capPart,balance,retained)
In order to account for this modified repayment scheme, the candidate need to change the line: intPart[j] <- ((1 + 0.025)ˆ{1/12} - 1)*outstanding[j]
to:
intPart[j] <- if(j <= 24){0}else{ ((1 + 0.025)ˆ{1/12} - 1)*outstanding[j] }
2023-01-09