juliaactuary / lifecontingencies.jl Goto Github PK
View Code? Open in Web Editor NEWLife Actuarial Maths
License: Other
Life Actuarial Maths
License: Other
Hello guys,
Nice project, here!
However, it'd be nice if we had fractional ages allowance by default.
For example, allowing fractional ages directly when instanciating SingleLife
objects knowing the fractional_assump
... this implies changing
the way a couple of methods are implemented but it's relatively a light!
Thanks.
Trying to create the plots toward the bottom of the README produces the following error:
julia> for (i, t) in enumerate(tables)
plot!(plt, issue_ages, whole_life_costs[i], label="$(t.d.name)")
end
ERROR: type UltimateTable has no field d
Stacktrace:
[1] getproperty(x::MortalityTables.UltimateTable{OffsetArrays.OffsetVector{Float64, Vector{Float64}}}, f::Symbol)
@ Base ./Base.jl:42
[2] top-level scope
@ ./REPL[362]:2
I tried looking for a way to extract a table name (or other field) from a table object, but it was not obvious or intuitive. fieldnames
was not helpful here. Needless to say, this underscores two issues:
life = SingleLife( # The life underlying the risk
mort = vbt2001.select[age], # -- Mortality rates
issue_age = 30 # -- Issue Age
)
yield = Yields.Constant(0.05) # Using a flat 5% interest rate
lc = LifeContingency(life, yield) # LifeContingency joins the risk with interest
ins = Insurance(lc) # Whole Life insurance
Any reason to not extend survival()
to work on life
? Currently only has method for ins
. Similar for other functions, e.g. survival(life,30,35)
This issue is used to trigger TagBot; feel free to unsubscribe.
If you haven't already, you should update your TagBot.yml
to include issue comment triggers.
Please see this post on Discourse for instructions and more details.
#14 added the structure and basic mortality rate calcs, but expand to make the insurance calcs work
e.g.:
v(lc,5)
instead of v(lc.int,5)
In trying to extend the built-in functions to include immediate annuities, I have encountered an area that highlights an ill-defined aspect of the API:
Currently, ä(ins,5)
(ä(ins,to_time)
) refers to the annuity-due payments that occur between times [0,5)
, so that includes five payments.
In extending this to an annuity certain, a(ins,5)
referring to the interval [0,5)
would only receive four payments at times 1,2,3,4.
This is inconsistent with how the literature portrays a(ins,5)
as the 5
refers not to time but number of payments.
Question is: change the API to be consistent with the literature?
Since, for example, Ax
has x
as an argument to the function, should the functions really be defined as A(lc,x)
instead of the current Ax(lc,x)
?
For some functions like reserve which is commonly denoted tVx
in the literature, it creates odd function calls:
tVx(lc,x,t)
V(lc,x,t)
net_premium_reserve(lc,x,t)
If switching to the less redundant functions, then namespace becomes an issue. For example, if there's a bunch of one letter variables (v
,a
,A
,V
, etc) then how to deal with this?
Possible solution:
annual_net_premium
instead of Px
P
) but don't export, and let the user pick if they want to bring the shortform versions into scopev(int,1:10)
returning the discount vector for times 1:10 seems a lot more useful than returning the 1-year discount rate at each of those time points. Makes #20 easier to refactor
Refactor to make the types of insurances, well, types instead of functions. Example:
Current:
annuity_due(ins)
currently calculates the present value of an annuity due.
Alternative:
a = AnnuityDue(ins)
constructs an object, for which the following functions would operate:
cashflows(a)
would produce the vector of cashflowssurvival(a)
would produce the survivorship vectortimepoints(a)
would produce the timepoints associated with the cashflowsdiscount(a)
would produce the discount vectorpresent_value(a)
would extend ActuaryUtilities.present_value
and calculate the APV via the present_value(ins.interest,cashflows(a) .* survival(a),timepoints(a))
Advantages of this:
ActuaryUtilities
Insurance(ins) - AnnuityDue(ins)
would create a new instance of a ContingencyCombination
where it combines the insurance benefit less the annuity payments, resulting in the net product cashflow.Disadvantages:
timepoints
may need to be calculated three times for an APV instead of just once.E.g. lapses, or different types of claims
There's a lot of very short characters exported by the module, which pollutes the user's namespace. Some solutions:
insurance
for A
and export the aliasesI'm leaning towards option 2 as the best use case for most people.
#19 did this for interest rates... but why not everything?
Avoid defining names that conflict between packages, such as cashflows and timepoints. Currently Yields.jl and LifeContingencies.jl have these defined. And may become even more pertinent if assets are added in a separate package, as hinted at in #37
It's convenient, but not particularly performant.
Pull interest rate functionality out of this package and utilize Yields.jl
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.