premium<-10000000
expense0<-0.03
expense1<-0.025
expense2<-0.008/100
expense3<-0.01/100
interest1<-(1.08)^(1/12)-1
interest2<-(1.05)^(1/12)-1
##policyholders##
F<-rep(0,62)
mc<-profit<-interest<-rep(0,61)
F[1]<-premium*(1-expense0)
interest[1]<-F[1]*interest1
F[2]<-F[1]-mc[1]+interest[1]
for(i in 2:61){
mc[i]<-F[i]*0.0025
interest[i]<-round((F[i]-mc[i])*interest1)
F[i+1]<-F[i]-mc[i]+interest[i]
}
data.frame(F[1:61],mc,interest)
##insurers##
cost<-round(premium*expense0)
ren.exp<-round(premium*expense2)
int<-round(cost*interest2)
DB<-round((10000000-F[2])*(1-exp(-0.006/12)))
lapse<-round(0.004*exp(-0.006/12)*0.1*F[2])
ini.exp<-premium*expense1
profit[1]<--ini.exp
profit[2]<-cost+ren.exp+int-DB+lapse
profit[1]
c(cost,ren.exp,int,DB,lapse,profit[2])
for(i in 3:13){
ren.exp<-round(premium*expense2+F[i]*expense3)
int<-round((mc[i]+ren.exp)*interest2)
DB<-round(max(10000000-F[i],0)*(1-exp(-0.006/12)))
lapse<-round(0.004*exp(-0.006/12)*0.1*F[i])
profit[i]<-mc[i]-ren.exp+int-DB+lapse
print(c(mc[i],ren.exp,int,DB,lapse,profit[i]))
}
for(i in 14:25){
ren.exp<-round(premium*expense2+F[i]*expense3)
int<-round((mc[i]+ren.exp)*interest2)
DB<-DB<-round(max(10000000-F[i],0)*(1-exp(-0.006/12)))
lapse<-round(0.002*exp(-0.006/12)*0.05*F[i])
profit[i]<-mc[i]-ren.exp+int-DB+lapse
print(c(mc[i],ren.exp,int,DB,lapse,profit[i]))
}
for(i in 26:61){
ren.exp<-round(premium*expense2+F[i]*expense3)
int<-round((mc[i]+ren.exp)*interest2)
DB<-round(max(10000000-F[i],0)*(1-exp(-0.006/12)))
lapse<-0
profit[i]<-mc[i]-ren.exp+int-DB+lapse
print(c(mc[i],ren.exp,int,DB,lapse,profit[i]))
}
profit
p1<-(1-0.004)*exp(-0.006/12)
p2<-(1-0.002)*exp(-0.006/12)
p3<-(1-0.001)*exp(-0.006/12)
surv<-c(1,1,p1^(1:11),p1^11*p2^(1:12),p1^11*p2^12*p3^(1:36))
pai<-profit*surv
v<-((1/1.12)^(1/12))^(0:60)
sum(pai*v)








