Refer to today's R lecture example 1b,

My code produce a different policy value to the solution uploaded and I can't figure out where I went wrong (I used prospective method rather than retrospective.

Here's my code:

tV=c()

for (t in 0:20){

A50t=SA*Axn(type="END",age=50+t,term =20-t, sp=T,i=int)

a50t=prem*axn(type="Temp",age =50+t, term =20-t, sp=T, i=int)

tV[t+1]=A50t-a50t

t=t+1

}

polvaluematrix=data.frame(tm=0:20,policy_Value =tV)

for (t in 0:20){

A50t=SA*Axn(type="END",age=50+t,term =20-t, sp=T,i=int)

a50t=prem*axn(type="Temp",age =50+t, term =20-t, sp=T, i=int)

tV[t+1]=A50t-a50t

t=t+1

}

polvaluematrix=data.frame(tm=0:20,policy_Value =tV)

Thank you!

Here's a hint:

The life was selected at age 50. Think about how this affects the "

sp=T"parameter in the annuity and assuarance functions.