Question: Add code at the appropriate location ( s ) ( and make all additional necessary changes throughout the program ) to implement the fixed percentage
Add code at the appropriate locationsand make all additional necessary changes throughout the program to implement the fixed percentage rule. When necessary, review the Horneff et al paper to remind yourself what that rule does. The final program is supposed to either simulate the fixed benefit or the fixed percentage rule, depending on user input provided when calling the evaluateWithdrawalPlan function.
Once your program produces the desired result, export the plot for your fixed percentage simulation as a pdf file manually is fine, no need to write corresponding code
parameters listm c # Expected annual logreturn
v c # Annual logreturn standard dev
rho # Correlation between stocks, bonds
stockFraction # Fraction of periodic wealth invested into stocks
deltaT # set to because simulation on annual basis
ageInitial
ageEnd
seed # Arbitrary "start value" for random number generator
nIterations # Number of simulation runs
initialWealth
fixedBenefitAmount
generateLogReturns functionparameters
# Simulation of asset returns
# Extract individual parameters from parameters list not technically necessary
# but improves readability of code below
m parameters$m
v parameters$v
rho parameters$rho
deltaT parameters$deltaT
nIterations parameters$nIterations
# Generate nIterations x matrix of N shocks
z rnormnIterations
z matrixz nrow nIterations, ncol
# Transform N shocks into nIterations x matrix of log return
# realizations for the assets using the multivariate Geometric Brownian
# Motion approach
returns matrixnrow nIterations, ncol
returns mdeltaT vsqrtdeltaTz # Returns for asset stock
returns mdeltaT # Returns for asset bond
rhovsqrtdeltaTz
sqrtrhovsqrtdeltaTz
returnreturns
calculateBenefit function withdrawalRule beginningOfPeriodWealth, t parameters
# Determine benefit based on withdrawal rule and wealth at a particular point in time
# Inputs:
# withdrawalRule: Character string naming the type of withdrawal rule to be analyzed
# fixedBenefit "fixedPercentage", "oneOverT", "oneOverET"
# beginningOfPeriodWealth: nIterations x vector holding the wealth at the beginning
# of a period for each of the nIterations simulation runs
# t: Index of current period for later use
# In each if structure below, an nIterations x vector of benefit payments will
# be determined depending on the rules of the particular withdrawal plan design
if withdrawalRule "fixedBenefit"
# In this plan design, the benefit is a prespecified constant amount as long
# as sufficient funds are available to pay the benefit, ie as long as
# benefit amount available wealth In case funds are no longer sufficient
# to pay the full benefit, the benefit is reduced to the amount of funds remaining.
# pmin compares each individual entry in the beginningOfPeriodWealth vector with
# the fixedBenefitAmount and finds the smaller of the two values.
benefit pminbeginningOfPeriodWealth parameters$fixedBenefitAmount
if withdrawalRule "fixedPercentage"
# tbd
if withdrawalRule "oneOverT"
# tbd
if withdrawalRule "oneOverET"
# tbd
return benefit
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
