juliaactuary / experienceanalysis.jl Goto Github PK
View Code? Open in Web Editor NEWExperience Analysis Utility Functions
License: MIT License
Experience Analysis Utility Functions
License: MIT License
actxps maintainer (mattheaphy/actxps#23) and SOA experience studies document indicate that not including partial exposures on left truncation is standard practice. Asking in linked issue about right truncation as well.
update: in linked issue the approach taken by actxps is to not include left truncation intervals but to include right truncation intervals. Not entirely sure of the consistency of these things. Maybe some simulated scenarios can help understand these things without going through the math. Or maybe going through the math is necessary. A bit unsure.
update 2: seems to be consistent with the advice from section 17.6.4 of experience studies document.
suppose we get this result from exposure
function
[(from = Date("2016-07-04"), to = Date("2017-07-04")), (from = Date("2017-07-04"), to = Date("2017-07-05"))]
because res[1].to == res[2].from
, I assume that they both refer to the same time on the clock (midnight?) so that there is no overlap. But if we get this result
[(from = Date("2016-07-04"), to = Date("2016-07-04"))]
then the interval of time represented by it contains only a single instant and has exposure of 0?
I propose an alternative -
first result
[(from = Date("2016-07-04"), to = Date("2017-07-03")), (from = Date("2017-07-04"), to = Date("2017-07-05"))]
second result
[(from = Date("2016-07-04"), to = Date("2016-07-04"))]
supposing we have implemented study_start
and study_end
How I interpret inputs -
issue
is the Dates.Date
containing the Dates.Instant
where the policy was issuedtermination
is the Dates.Date
containing the Dates.Instant
where the policy was terminatedstudy_start
includes the entire day, starts at midnightstudy_end
includes the entire day, ends at 23:59.9999...
military timeHow I interpret the outputs -
tuple.from
is the beginning of the date interval. How does this relate to the Date.Instant
where policy is issued?
issue < study_start
then the first interval's tuple.from
refers to midnight/beginning of day, so that the entire day is included.issue >= study_start
then the first interval's tuple.from
might most accurately be a Dates.Instant
, but we simplify things by allowing tuple.from
to start at midnight, so that there is a full exposure and that we are consistent with our other case.tuple.to
is the end of the date interval. How does this relate to the Date.Instant
where policy is terminated or where the study ends?
study_end < termination
then we suppose that the study_end
means we should include the entire day of study_end
and the Dates.Instant
of tuple.to
is at 23:59.999
military time.study_end >= termination
then the termination happens at some time during this day, but we simplify by allowing tuple.to
to end at 23:59.999
.In this interpretation the simplification causes some error, maybe some analysis should be done to estimate or put bounds on this error. Maybe this is done in that document from the SOA linked in the description.
exposure(Anniversary(Month(1)), Date(2013, 1, 31), Date(2012, 4, 1))
gives
1-element Vector{NamedTuple{(:from, :to), Tuple{Date, Date}}}:
(from = Date("2013-01-31"), to = Date("2012-04-01"))
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.
If you'd like for me to do this for you, comment TagBot fix
on this issue.
I'll open a PR within a few hours, please be patient!
Thinking about an API that just returns an iterator of dates for the partitions.
Think it can be faster than pushing to array? Also maybe less opinionated than doing the NamedTuple with from and to.
We have code like
struct Anniversary{T} <: ExposurePeriod
pol_period::T
end
but I think it should be something like
struct Anniversary <: ExposurePeriod
pol_period::Period
end
and probably even as strict as
struct Anniversary <: ExposurePeriod
pol_period::DatePeriod
end
I don't think there it necessary to operate at any granularity finer than a single day, so I am going to be using DatePeriod instead of Period in a PR.
reproduction
using ExperienceAnalysis
using Dates
exposure(ExperienceAnalysis.Calendar(Year(1)), Date(2006,6,15), Date(2020,2,29), true) # works
exposure(ExperienceAnalysis.Calendar(Hour(1)), Date(2006,6,15), Date(2020,2,29), true) # ERROR: MethodError: no method matching floor(::Date, ::Hour)
This is because floor of date only works for DatePeriod
It isn't clear how I am to get the policy year from an exposure interval
Currently, exposures(basis,from,to,continued_exposure=false)
uses the from
argument as the anchor point for anniversaries. Refactor to allow the study start to be incorporated? Currently process is a little clunky.
Alternative API could be: exposure(basis,anniv_date,termination_date,study_start,study_end,continued_exposure=false)
This is also not ideal because termination_date
could be a date, or nothing
, or missing
or however user has data stored. Perhaps enforce that it must be a date or nothing
?
Brainstorm ideas for built-in functionality here (or open new, separate issue)
Seems like just indicating that the interval is the final interval and contains the decrement we are analyzing will work. I am not sure how continued_exposure
will work for AnniversaryCalendar
. The equation is probably like
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.