Stock Price Simulation in R
Transcript of Stock Price Simulation in R
-
7/28/2019 Stock Price Simulation in R
1/37
Actuarial andfinancial applications
of simulation
EA Valdez
Modeling stock pricesThe lognormal distribution
Illustrative example
R code to generate the
stock price process
Pictorial illustration
Lognormal property
Illustration of generating
distribution of stock price
Distribution graph
Generating distribution of aportfolio of assets
Modeling aggregateclaims
Distribution assumptions
Case illustration
Simulation
Modeling in lifeinsurance
The Gompertz lifetime
distribution
Simulating from Gompertz
Simulating the loss
Parameter assumptions
Simulation results
page 1
Actuarial and financial applications
of simulationMath 276 Actuarial Models
Spring 2008 semester
EA ValdezUniversity of Connecticut - Storrs
Lecture Weeks 6 and 7
-
7/28/2019 Stock Price Simulation in R
2/37
Actuarial andfinancial applications
of simulation
EA Valdez
Modeling stock pricesThe lognormal distribution
Illustrative example
R code to generate the
stock price process
Pictorial illustration
Lognormal property
Illustration of generating
distribution of stock price
Distribution graph
Generating distribution of aportfolio of assets
Modeling aggregateclaims
Distribution assumptions
Case illustration
Simulation
Modeling in lifeinsurance
The Gompertz lifetime
distribution
Simulating from Gompertz
Simulating the loss
Parameter assumptions
Simulation results
page 2
Modeling stock prices
In finance, we are always interested in the return onstocks.
The Normal distribution is a typical distribution model forreturn on the stock; indeed equivalent to modeling thevalue of the stock as a lognormal distribution.
Assume that the return on the stock is normally distributed
with annual mean and annual standard deviation .
Denote by St the value of the asset at time t and St+tdenoting the the value t periods later. Thus, thepercentage change (or return) of the value of the stockbetween times t and t+t is approximated by
log St log St+t = logSt
St+t= log (1 + rt) rt,
where rt = (St St+t)/St.
-
7/28/2019 Stock Price Simulation in R
3/37
Actuarial andfinancial applications
of simulation
EA Valdez
Modeling stock pricesThe lognormal distribution
Illustrative example
R code to generate the
stock price process
Pictorial illustration
Lognormal property
Illustration of generating
distribution of stock price
Distribution graph
Generating distribution of aportfolio of assets
Modeling aggregateclaims
Distribution assumptions
Case illustration
Simulation
Modeling in lifeinsurance
The Gompertz lifetime
distribution
Simulating from Gompertz
Simulating the loss
Parameter assumptions
Simulation results
page 3
The lognormal distribution (and geometric diffusions)
Another way to write the stock price at time t+t is
St+t = St expt+ Z
t
,
where Z is standard normal N(0,1).
If you know diffusion processes, this is the discreteanalogue of the geometric diffusion:
dS
S= dt+ dB,
where dB is a Brownian motion (or Weiner) process withdB= Z
dt.
-
7/28/2019 Stock Price Simulation in R
4/37
Actuarial andfinancial applications
of simulation
EA Valdez
Modeling stock pricesThe lognormal distribution
Illustrative example
R code to generate the
stock price process
Pictorial illustration
Lognormal property
Illustration of generating
distribution of stock price
Distribution graph
Generating distribution of aportfolio of assets
Modeling aggregateclaims
Distribution assumptions
Case illustration
Simulation
Modeling in lifeinsurance
The Gompertz lifetime
distribution
Simulating from Gompertz
Simulating the loss
Parameter assumptions
Simulation results
page 4
Illustrative example
Consider a stock paying no dividends with a volatility
= 0.05 per annum and with an expected return of = 0.10 per annum with continuous compounding.
The stock price process can be written asdS
S= 0.10dt+ 0.20dB or (in the discrete sense) with
small interval of timeS
S= 0.15t+ 0.20Z
t.
The figures in the following page demonstrate this price
process (by simulation) for different time intervals: year(t= 1), month (t= 1/12), week (t= 1/52), and day(t= 1/365).
Here we assume the initial stock price is 100.
-
7/28/2019 Stock Price Simulation in R
5/37
Actuarial andfinancial applications
of simulation
EA Valdez
Modeling stock pricesThe lognormal distribution
Illustrative example
R code to generate the
stock price process
Pictorial illustration
Lognormal property
Illustration of generating
distribution of stock price
Distribution graph
Generating distribution of aportfolio of assets
Modeling aggregateclaims
Distribution assumptions
Case illustration
Simulation
Modeling in lifeinsurance
The Gompertz lifetimedistribution
Simulating from Gompertz
Simulating the loss
Parameter assumptions
Simulation results
page 5
R code to generate the stock price process
The following is a routine in R to generate the stock priceprocess. Function is called simstock.R.
# function to generate (discrete) stock price process
simstock
-
7/28/2019 Stock Price Simulation in R
6/37
Actuarial andfinancial applications
of simulation
EA Valdez
Modeling stock pricesThe lognormal distribution
Illustrative example
R code to generate the
stock price process
Pictorial illustration
Lognormal property
Illustration of generating
distribution of stock price
Distribution graph
Generating distribution of aportfolio of assets
Modeling aggregateclaims
Distribution assumptions
Case illustration
Simulation
Modeling in lifeinsurance
The Gompertz lifetimedistribution
Simulating from Gompertz
Simulating the loss
Parameter assumptions
Simulation results
page 6
Pictorial illustration of the stock price process
0 5 10 15 20
100
200
300
400
500
600
700
year
stock
price
0 50 100 150 200
100
200
300
400
month
stock
price
0 200 400 600 800 1000
200
400
600
800
1000
week
stock
price
0 2000 4000 6000
100
200
300
400
day
stock
price
-
7/28/2019 Stock Price Simulation in R
7/37
Actuarial andfinancial applications
of simulation
EA Valdez
Modeling stock pricesThe lognormal distribution
Illustrative example
R code to generate the
stock price process
Pictorial illustration
Lognormal property
Illustration of generating
distribution of stock price
Distribution graph
Generating distribution of aportfolio of assets
Modeling aggregateclaims
Distribution assumptions
Case illustration
Simulation
Modeling in lifeinsurance
The Gompertz lifetimedistribution
Simulating from Gompertz
Simulating the loss
Parameter assumptions
Simulation results
page 7
Lognormal property of stock prices
In the geometric Brownian motion, the change in the log Sbetween time 0 and T has a Normal distribution with
log ST log S0 N( 2/2)T, 2T
,
where S0 is the initial stock price while ST is the stockprice T periods later.
This is equivalent to ST having a lognormal distribution:
log ST N
log S0 + ( 2/2)T, 2T.
It is straightforward to show that the mean is given by
E(ST) = S0eT
,
and the variance is
Var(ST) = S20 e
2T
e2T 1
.
-
7/28/2019 Stock Price Simulation in R
8/37
-
7/28/2019 Stock Price Simulation in R
9/37
Actuarial andfinancial applications
of simulation
EA Valdez
Modeling stock pricesThe lognormal distribution
Illustrative example
R code to generate the
stock price process
Pictorial illustration
Lognormal property
Illustration of generating
distribution of stock price
Distribution graph
Generating distribution of aportfolio of assets
Modeling aggregateclaims
Distribution assumptions
Case illustration
Simulation
Modeling in lifeinsurance
The Gompertz lifetimedistribution
Simulating from Gompertz
Simulating the loss
Parameter assumptions
Simulation results
page 8
R code to illustrate simulating the stock price at time T
The following is a routine in R to generate the stock price attime T. Function is called simstprice.R.
# function to generate stock price/value at time T
simstprice
-
7/28/2019 Stock Price Simulation in R
10/37
Actuarial andfinancial applications
of simulation
EA Valdez
Modeling stock pricesThe lognormal distribution
Illustrative example
R code to generate the
stock price process
Pictorial illustration
Lognormal property
Illustration of generating
distribution of stock price
Distribution graph
Generating distribution of aportfolio of assets
Modeling aggregateclaims
Distribution assumptions
Case illustration
Simulation
Modeling in lifeinsurance
The Gompertz lifetimedistribution
Simulating from Gompertz
Simulating the loss
Parameter assumptions
Simulation results
page 9
Graphical representation of the distribution
> hist(out1,br=25,xlab="initial price = $40",ylab="stock price after half year",main="1,000
simulations from logNormal with mu=30%, sigma=10%",freq=FALSE)
> lines(density(out1),xlim=c(20,80),col="blue")
1,000 simulations from logNormal with mu=30%, sigma=10%
initial price = $40
stock
price
afterhalfye
ar
20 30 40 50 60 70 80
0.
00
0
.01
0.
02
0.
03
0
.04
0.
05
-
7/28/2019 Stock Price Simulation in R
11/37
Actuarial andfinancial applications
of simulation
EA Valdez
Modeling stock pricesThe lognormal distribution
Illustrative example
R code to generate the
stock price process
Pictorial illustration
Lognormal property
Illustration of generating
distribution of stock price
Distribution graph
Generating distribution of aportfolio of assets
Modeling aggregateclaims
Distribution assumptions
Case illustration
Simulation
Modeling in lifeinsurance
The Gompertz lifetimedistribution
Simulating from Gompertz
Simulating the loss
Parameter assumptions
Simulation results
page 10
R code to illustrate simulating a portfolio of assetsThe following is a routine in R to generate the value of aportfolio of stocks at time T. Function is calledsimportfolio.R.
# function to generate a portfolio of securities at time T
# the variables required: n.gen (number to simulate), S0.vector (vector of initial# values of the stocks), mu.vector/sigma.vector (self-explanatory), n.holdings
# (the number of holdings for each corresponding stock), T (valuation date)
simportfolio
-
7/28/2019 Stock Price Simulation in R
12/37
Actuarial andfinancial applications
of simulation
EA Valdez
Modeling stock prices
The lognormal distribution
Illustrative example
R code to generate the
stock price process
Pictorial illustration
Lognormal property
Illustration of generating
distribution of stock price
Distribution graph
Generating distribution of aportfolio of assets
Modeling aggregateclaims
Distribution assumptions
Case illustration
Simulation
Modeling in lifeinsurance
The Gompertz lifetimedistribution
Simulating from Gompertz
Simulating the loss
Parameter assumptions
Simulation results
page 11
Graphical representation of the resulting portfoliodistribution
> hist(out1,br=25,xlab="",ylab="portfolio value",main="Distribution of Portfolio Value after 5
years",freq=FALSE,xlim=c(50000,250000))
> lines(density(out1),xlim=c(50000,250000),col="blue")
Distribution of Portfolio Value after 5 years
portfolio
value
50000 100000 150000 200000 250000
0.0
e+00
5.
0e
06
1.
0e05
1.5
e05
2.0e05
2.
5e05
A i l d
-
7/28/2019 Stock Price Simulation in R
13/37
Actuarial andfinancial applications
of simulation
EA Valdez
Modeling stock prices
The lognormal distribution
Illustrative example
R code to generate the
stock price process
Pictorial illustration
Lognormal property
Illustration of generating
distribution of stock price
Distribution graph
Generating distribution of aportfolio of assets
Modeling aggregateclaims
Distribution assumptions
Case illustration
Simulation
Modeling in lifeinsurance
The Gompertz lifetimedistribution
Simulating from Gompertz
Simulating the loss
Parameter assumptions
Simulation results
page 12
Some statistics on the resulting portfolio distribution
> source("C:\\...\\Math276-Spring2008\\Rcodes-2008\\Week67\\Data.SummStats.R")
> Data.SummStats(out1)
Value
Number 1.000e+03
Mean 1.181e+05
5th Q 9.157e+04
25th Q 1.042e+05
Median 1.167e+05
75th Q 1.279e+05
95th Q 1.530e+05
Variance 3.533e+08
StdDev 1.880e+04
Minimum 7.529e+04
Maximum 2.382e+05
Skewness 9.300e-01
Kurtosis 2.080e+00
>
A t i l d
-
7/28/2019 Stock Price Simulation in R
14/37
Actuarial andfinancial applications
of simulation
EA Valdez
Modeling stock prices
The lognormal distribution
Illustrative example
R code to generate the
stock price process
Pictorial illustration
Lognormal property
Illustration of generating
distribution of stock price
Distribution graph
Generating distribution of aportfolio of assets
Modeling aggregateclaims
Distribution assumptions
Case illustration
Simulation
Modeling in lifeinsurance
The Gompertz lifetimedistribution
Simulating from Gompertz
Simulating the loss
Parameter assumptions
Simulation results
page 13
The distribution of the total claim amount
In general (property/casualty) insurance, we often studythe distribution of the aggregate claim amount defined by
S= X1 + X2 + + XN,where Xi is the amount of the i-th claim and N refers to thenumber of claims.
Here we are referring to the total claims only for a fixed
period, e.g. one year, though this can be a stochasticprocess (over time).
The standard assumptions in the model are:
1 the claim amounts Xi are i.i.d. (independent and identicallydistributed) random variables; and
2 the claim amounts X1,X2, . . . and the claim count N are allindependent.
The aggregate sum S has what we call a compounddistribution, and in many instances, it is not possible to
derive explicit form of its distribution.
Actuarial andCl i i d l i di ib i i
-
7/28/2019 Stock Price Simulation in R
15/37
Actuarial andfinancial applications
of simulation
EA Valdez
Modeling stock prices
The lognormal distribution
Illustrative example
R code to generate the
stock price process
Pictorial illustration
Lognormal property
Illustration of generating
distribution of stock price
Distribution graph
Generating distribution of aportfolio of assets
Modeling aggregateclaims
Distribution assumptions
Case illustration
Simulation
Modeling in lifeinsurance
The Gompertz lifetimedistribution
Simulating from Gompertz
Simulating the loss
Parameter assumptions
Simulation results
page 14
Claim size and claim count distribution assumptions
For purposes of illustration, we shall assume the following:
The claim size Xi has the Pareto(, ) distribution with CDF
F(x) = 1
x +
, for x > 0.
The claim count N is assumed to have a Poisson()distribution.
Note that to simulate from the Pareto, it can be shown that,using the inverse transform method, the followinggenerates a Pareto(, ) random variable:
X= (1 U)1/ 1
.
-
7/28/2019 Stock Price Simulation in R
16/37
-
7/28/2019 Stock Price Simulation in R
17/37
-
7/28/2019 Stock Price Simulation in R
18/37
-
7/28/2019 Stock Price Simulation in R
19/37
Actuarial andCase illustration
-
7/28/2019 Stock Price Simulation in R
20/37
financial applicationsof simulation
EA Valdez
Modeling stock prices
The lognormal distribution
Illustrative example
R code to generate the
stock price process
Pictorial illustration
Lognormal property
Illustration of generating
distribution of stock price
Distribution graph
Generating distribution of a
portfolio of assets
Modeling aggregateclaims
Distribution assumptions
Case illustration
Simulation
Modeling in lifeinsurance
The Gompertz lifetimedistribution
Simulating from Gompertz
Simulating the loss
Parameter assumptions
Simulation results
page 15
Case illustration
Consider a portfolio of 10,000 automobile insurance
policies with the following assumptions:The period is exactly one year where each policy pays anannual premium of = $500.
Expenses include an overhead (or fixed) expense of$500,000 and a per policy expense of $2.50.
The aggregate claims distribution assume that claim sizehas a Pareto with = 625 and = 1.5 and claim count hasa Poisson with = 900.
The Profit/Loss (P/L) for this insurance portfolio is clearlyPremiums - (Claims + Expenses) where:
Premiums: 10, 000 = 10, 000(500) = 5, 000, 000
Claims: S = X1 + X2 + + XN
Expenses: 500, 000 + 2.5 10, 000 = 525, 000
Actuarial andR code to illustrate simulating the aggregate claims
-
7/28/2019 Stock Price Simulation in R
21/37
financial applicationsof simulation
EA Valdez
Modeling stock prices
The lognormal distribution
Illustrative example
R code to generate the
stock price process
Pictorial illustration
Lognormal property
Illustration of generating
distribution of stock price
Distribution graph
Generating distribution of a
portfolio of assets
Modeling aggregateclaims
Distribution assumptions
Case illustration
Simulation
Modeling in lifeinsurance
The Gompertz lifetimedistribution
Simulating from Gompertz
Simulating the loss
Parameter assumptions
Simulation results
page 16
R code to illustrate simulating the aggregate claimsThe following is a routine in R to generate the aggregate claimamount for a portfolio of auto insurance policies. Function iscalled simillustrate.R.
# function to simulate the aggregate claims using the illustration
simillustrate
-
7/28/2019 Stock Price Simulation in R
22/37
financial applicationsof simulation
EA Valdez
Modeling stock prices
The lognormal distribution
Illustrative example
R code to generate the
stock price process
Pictorial illustration
Lognormal property
Illustration of generating
distribution of stock price
Distribution graph
Generating distribution of a
portfolio of assets
Modeling aggregateclaims
Distribution assumptions
Case illustration
Simulation
Modeling in lifeinsurance
The Gompertz lifetimedistribution
Simulating from Gompertz
Simulating the loss
Parameter assumptions
Simulation results
page 17
Histograms of the aggregate claims distribution
> hist(out1/1000000,br=50,xlab="in millions",ylab="frequency",main="Distribution of Aggregate
Claims",freq=FALSE)
> min(log(out1))
[1] 13.41646
> max(log(out1))
[1] 17.02933
> hist(log(out1),br=50,xlab="in logarithm",ylab="frequency",main="Distribution of AggregateClaims",freq=FALSE,xlim=c(13,17))
>
Distribution of Aggregate Claims
in millions
frequency
0 5 10 15 20 25
0.
0
0.
2
0
.4
0.
6
0.
8
1.
0
Distribution of Aggregate Claims
in logarithm
frequency
13 14 15 16 17
0.
0
0.
5
1.
0
1.
5
2.
0
2.5
Actuarial andfinancial applicationsProfit/loss analysis
-
7/28/2019 Stock Price Simulation in R
23/37
financial applicationsof simulation
EA Valdez
Modeling stock prices
The lognormal distribution
Illustrative example
R code to generate the
stock price process
Pictorial illustration
Lognormal property
Illustration of generating
distribution of stock price
Distribution graph
Generating distribution of a
portfolio of assets
Modeling aggregateclaims
Distribution assumptions
Case illustration
Simulation
Modeling in lifeinsurance
The Gompertz lifetimedistribution
Simulating from Gompertz
Simulating the loss
Parameter assumptions
Simulation results
page 18
Profit/loss analysis> pl Data.SummStats(pl)
Value
Number 1.000e+04
Mean 3.345e+06
5th Q 2.943e+06
25th Q 3.302e+06
Median 3.427e+0675th Q 3.518e+06
95th Q 3.620e+06
Variance 3.618e+11
StdDev 6.015e+05
Minimum -2.040e+07
Maximum 3.804e+06
Skewness -2.076e+01
Kurtosis 6.096e+02
Profit/Loss Distribution
in millions
frequency
20 15 10 5 0 5
0.
0
0.
2
0.
4
0.
6
0.
8
1.
0
1.
2
Actuarial andfinancial applicationsIntroduction - life insurance models
-
7/28/2019 Stock Price Simulation in R
24/37
financial applicationsof simulation
EA Valdez
Modeling stock prices
The lognormal distribution
Illustrative example
R code to generate the
stock price process
Pictorial illustration
Lognormal property
Illustration of generating
distribution of stock price
Distribution graph
Generating distribution of a
portfolio of assets
Modeling aggregateclaims
Distribution assumptions
Case illustration
Simulation
Modeling in lifeinsurance
The Gompertz lifetimedistribution
Simulating from Gompertz
Simulating the loss
Parameter assumptions
Simulation results
page 19
Introduction life insurance models
The actuarial equivalence principle has one maindrawback: it simply looks at the mean/average of theloss-at-issue distribution.
Alternative is to also examine the variability of this loss, butthis does not give the complete picture of the lossdistribution.
A much better alternative is to examine the loss
distribution itself.
In many cases, it is impossible to derive explicit form of theloss distribution.
Simulating the loss distribution is one method to do it -
main drawback is it may require computer-intensivecalculations.
We demonstrate this only for a whole life insurance policyissued to a single person - in practice, you would be doingthis for a portfolio of insurance contracts.
-
7/28/2019 Stock Price Simulation in R
25/37
Actuarial andfinancial applicationsThe Gompertz lifetime distribution
-
7/28/2019 Stock Price Simulation in R
26/37
financial applicationsof simulation
EA Valdez
Modeling stock prices
The lognormal distribution
Illustrative example
R code to generate the
stock price process
Pictorial illustration
Lognormal property
Illustration of generating
distribution of stock price
Distribution graph
Generating distribution of a
portfolio of assets
Modeling aggregateclaims
Distribution assumptions
Case illustration
Simulation
Modeling in lifeinsurance
The Gompertz lifetimedistribution
Simulating from Gompertz
Simulating the loss
Parameter assumptions
Simulation results
page 20
p
Assume that mortality follows the Gompertz with force ofmortality
x = Bcx,
where B and c are constants satisfying B> 0 and c> 1.
It is easy to show that for an issue age x, its future lifetimeTx follows the survival pattern
STx(t) = P(Tx > t) = exp
Bcxlog(c)
ct 1
,
for t 0.
-
7/28/2019 Stock Price Simulation in R
27/37
-
7/28/2019 Stock Price Simulation in R
28/37
Actuarial andfinancial applicationsSimulating from Gompertz
-
7/28/2019 Stock Price Simulation in R
29/37
of simulation
EA Valdez
Modeling stock prices
The lognormal distribution
Illustrative example
R code to generate the
stock price process
Pictorial illustration
Lognormal property
Illustration of generating
distribution of stock price
Distribution graph
Generating distribution of a
portfolio of assets
Modeling aggregateclaims
Distribution assumptions
Case illustration
Simulation
Modeling in lifeinsurance
The Gompertz lifetime
distribution
Simulating from Gompertz
Simulating the loss
Parameter assumptions
Simulation results
page 21
We can use the inverse transform method to simulate from
Gompertz.Begin with a random number U, generate a Gompertzlifetime, say T, from the following equation:
expBcx
log(c)cT
1 = U,or equivalently, we have
T =1
log(c)log
1 log(c) log(U)
Bcx
.
Running this procedure m(number of simulations) times,we can then have a simulated distribution of the Gompertzlifetime.
Actuarial andfinancial applicationsSimulating the loss-at-issue
-
7/28/2019 Stock Price Simulation in R
30/37
of simulation
EA Valdez
Modeling stock prices
The lognormal distribution
Illustrative example
R code to generate the
stock price process
Pictorial illustration
Lognormal property
Illustration of generating
distribution of stock price
Distribution graph
Generating distribution of a
portfolio of assets
Modeling aggregateclaims
Distribution assumptions
Case illustration
Simulation
Modeling in lifeinsurance
The Gompertz lifetime
distribution
Simulating from Gompertz
Simulating the loss
Parameter assumptions
Simulation results
page 22
With a simulated value of T, we can then simulate a valueof the present value of the loss-at-issue.
For example, in a (fully continuous) whole life insurancecontract, we have
L0 = bTvT
aT
,
where v= 1/(1 + i) = e is the discount factor, is theannual premium assumed to be payable continuouslythroughout the year, and bT is the amount of insurancepayable at death.
Again, run this procedure for mnumber of times to get asimulated distribution of the loss-at-issue.
-
7/28/2019 Stock Price Simulation in R
31/37
Actuarial andfinancial applications
of simulation
Simulating the loss after k years
-
7/28/2019 Stock Price Simulation in R
32/37
of simulation
EA Valdez
Modeling stock prices
The lognormal distribution
Illustrative example
R code to generate the
stock price process
Pictorial illustration
Lognormal property
Illustration of generating
distribution of stock price
Distribution graph
Generating distribution of a
portfolio of assets
Modeling aggregateclaims
Distribution assumptions
Case illustration
Simulation
Modeling in lifeinsurance
The Gompertz lifetime
distribution
Simulating from Gompertz
Simulating the loss
Parameter assumptions
Simulation results
page 23
When computing reserves, we need to evaluate the loss atthat point.
Suppose we are interested in the loss after k years, then itcan be shown that the simulated lifetime for the personwho is then aged x+ k is
T =1
log(c)log 1
log(c) log(U)Bcx+k
,where U is U(0,1) generated value.
For the same (fully continuous) whole life insurancecontract, we would have the loss after k years evaluated
asLk = bTv
T aT,
where T is the future lifetime of the person x who is nowaged x+ k.
Actuarial andfinancial applications
of simulation
Parameter assumptions
-
7/28/2019 Stock Price Simulation in R
33/37
of simulation
EA Valdez
Modeling stock prices
The lognormal distribution
Illustrative example
R code to generate the
stock price process
Pictorial illustration
Lognormal property
Illustration of generating
distribution of stock price
Distribution graph
Generating distribution of a
portfolio of assets
Modeling aggregateclaims
Distribution assumptions
Case illustration
Simulation
Modeling in lifeinsurance
The Gompertz lifetime
distribution
Simulating from Gompertz
Simulating the loss
Parameter assumptions
Simulation results
page 24
To illustrate, we assume the following Gompertz parametervalues:
B= 0.0000429 and c= 1.1070839.
In addition, benefit amount is $100, premium is $0.0095
per $1 of insurance, and i= 5%.Number of simulations: 50,000.
Apart from calculating the losses at issue, we alsocalculate reserves (or losses) at the end of 10 years.
The R routine is called Gompertz.SimulationT.R - toolong to print in these slides; but is available on the website.
Actuarial andfinancial applications
of simulation
Some summary statistics of the simulation results
-
7/28/2019 Stock Price Simulation in R
34/37
of simulation
EA Valdez
Modeling stock prices
The lognormal distribution
Illustrative example
R code to generate the
stock price process
Pictorial illustration
Lognormal property
Illustration of generating
distribution of stock price
Distribution graph
Generating distribution of a
portfolio of assets
Modeling aggregateclaims
Distribution assumptions
Case illustration
Simulation
Modeling in lifeinsurance
The Gompertz lifetime
distribution
Simulating from Gompertz
Simulating the loss
Parameter assumptions
Simulation results
page 25
> source("C:\\...\\Math276-Spring2008\\Rcodes-2008\\Week67\\Gompertz.SimulationT.R")
Value
Number 50000.00Mean 41.19
5th Q 18.90
25th Q 34.41
Median 42.97
75th Q 49.71
95th Q 57.16
Variance 136.32
StdDev 11.68
Minimum 0.00
Maximum 71.08
Skewness -0.74Kurtosis 0.40
Value
Number 50000.00
Mean -0.18
5th Q -12.12
25th Q -8.90
Median -4.79
75th Q 2.82
95th Q 28.04
Variance 212.20
StdDev 14.57
Minimum -15.75
Maximum 99.99
Skewness 2.79
Kurtosis 10.19
Actuarial andfinancial applications
of simulation
- continued
-
7/28/2019 Stock Price Simulation in R
35/37
of simulation
EA Valdez
Modeling stock prices
The lognormal distribution
Illustrative example
R code to generate the
stock price process
Pictorial illustration
Lognormal property
Illustration of generating
distribution of stock price
Distribution graph
Generating distribution of a
portfolio of assets
Modeling aggregateclaims
Distribution assumptions
Case illustration
Simulation
Modeling in lifeinsurance
The Gompertz lifetime
distribution
Simulating from Gompertz
Simulating the loss
Parameter assumptions
Simulation results
page 26
Value
Number 50000.00
Mean 31.745th Q 10.85
25th Q 24.90
Median 33.18
75th Q 39.83
95th Q 47.26
Variance 119.26
StdDev 10.92
Minimum 0.01
Maximum 59.04
Skewness -0.54
Kurtosis -0.14
Value
Number 50000.00
Mean 10.16
5th Q -7.56
25th Q -2.36
Median 4.20
75th Q 15.98
95th Q 50.89
Variance 353.57
StdDev 18.80Minimum -12.77
Maximum 99.95
Skewness 1.93
Kurtosis 4.21
Actuarial andfinancial applications
of simulation
Graphical displays of the simulation results
-
7/28/2019 Stock Price Simulation in R
36/37
EA Valdez
Modeling stock prices
The lognormal distribution
Illustrative example
R code to generate the
stock price process
Pictorial illustration
Lognormal property
Illustration of generating
distribution of stock price
Distribution graph
Generating distribution of a
portfolio of assets
Modeling aggregateclaims
Distribution assumptions
Case illustration
Simulation
Modeling in lifeinsurance
The Gompertz lifetime
distribution
Simulating from Gompertz
Simulating the loss
Parameter assumptions
Simulation results
page 27
Distribution of T(30)
t.30
frequency
0 10 30 50 70
0.
00
0.
02
Distribution of Lossatissue
loss.30
frequency
20 0 20 40 60 80
0.
00
0.
02
0.
04
0.
06
Distribution of T(40)
t.40
freq
uency
0 10 20 30 40 50 60
0.
00
0
.02
0.
04
Distribution of Loss at 10 yrs
loss.40
freq
uency
0 20 40 60 80 100
0.
00
0.
02
0.
04
Actuarial andfinancial applications
of simulation
Graphical displays of simulating repeatedly
-
7/28/2019 Stock Price Simulation in R
37/37
EA Valdez
Modeling stock prices
The lognormal distribution
Illustrative example
R code to generate the
stock price process
Pictorial illustration
Lognormal property
Illustration of generating
distribution of stock price
Distribution graph
Generating distribution of a
portfolio of assets
Modeling aggregateclaims
Distribution assumptions
Case illustration
Simulation
Modeling in lifeinsurance
The Gompertz lifetime
distribution
Simulating from Gompertz
Simulating the loss
Parameter assumptions
Simulation results
page 28
0 20 40 60
0.0
0
0.0
2
T(30)
N = 50000 Bandwidth = 1.182
Density
20 0 20 40 60 80
0.0
0
0.0
2
0.0
4
0.0
6
loss at issue
N = 50000 Bandwidth = 0.9113
Density
0 10 20 30 40 50 60
0.0
0
0.0
2
T(40)
N = 50000 Bandwidth = 1.124
De
nsity
20 0 20 40 60 80
0.0
0
0.0
2
0.0
4
loss after 10 yrs
N = 50000 Bandwidth = 1.397
De
nsity