-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature] Add a Life
extractor
#8
Conversation
Life
random variables extracted from a rate table
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have an issue that is that
julia> L = Life(slopop[:male], 7000, 1940*365.241)
Life(
∂t: [5.093170329928398e-11, 304.8199999999488, 60.42100000005121, 304.8199999999488, 60.42100000005121, 304.8199999999488, 60.42100000005121, 304.8199999999488, 60.42100000005121, 304.8199999999488 … 60.42100000005121, 304.8199999999488, 60.42100000005121, 304.8199999999488, 60.42100000005121, 304.8199999999488, 60.42100000005121, 304.8199999999488, 60.42100000005121, 304.8199999999488]
λ: [1.18259308900975e-5, 1.18259308900975e-5, 1.31461386213319e-5, 1.31461386213319e-5, 1.43568885285431e-5, 1.43568885285431e-5, 1.52653024528616e-5, 1.52653024528616e-5, 1.59261564872642e-5, 1.59261564872642e-5 … 0.000952040196524071, 0.000733071745918347, 0.000660281996864776, 0.00105021724521249, 0.00123749831958367, 0.00112796698379798, 0.000624953529261446, 0.00105591234503242, 0.00111013031972907, 0.000734484865047132]
)
julia> expectation(L)/265.241
67.35108708597433
which is OK, but
julia> L = Life(slopop[:male], 7000, 1990*365.241)
Life(
∂t: [3.637978807091713e-12, 304.81999999999607, 60.421000000003914, 304.81999999999607, 60.421000000003914, 304.81999999999607, 60.421000000003914, 304.81999999999607, 60.421000000003914, 304.81999999999607 … 60.421000000003914, 304.81999999999607, 60.421000000003914, 304.81999999999607, 60.421000000003914, 304.81999999999607, 60.421000000003914, 304.81999999999607, 60.421000000003914, 304.81999999999607]
λ: [5.5910580526963e-6, 3.17782866861003e-6, 3.45195218341532e-6, 4.76812723189004e-6, 4.60357074517423e-6, 3.39712528476538e-6, 3.45195218341532e-6, 4.1922227932534e-6, 5.20699288852109e-6, 4.21964406742172e-6 … 4.38476258334695e-6, 5.32225320572007e-6, 7.32946027661339e-6, 6.63278668692437e-6, 7.52554010487343e-6, 4.17886868465e-6, 8.4691237966412e-6, 6.39964683932395e-6, 9.31110361684609e-6, 9.953004363499262e-6]
)
julia> expectation(L)/265.241
41.55705546700694
i.e. people youger have a life expectation that goes up to today and then they are out.
maybe we need to do something w.r.t. the remaining survival at the end of tha table ? This might be one of the reason our numbers do not reconciles with R. But then the question is how do they correct for this in R ?
Edit : 265 instead of 365 but same conclusion
Life
random variables extracted from a rate tableLife
extractor
With the last modifications this should be good to go. Todo before merging :
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #8 +/- ##
==========================================
+ Coverage 70.17% 73.68% +3.50%
==========================================
Files 3 4 +1
Lines 57 114 +57
==========================================
+ Hits 40 84 +44
- Misses 17 30 +13 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, looks good to me. However it lacks a test to be good to go. Only a test that enforces the syntax of calling it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let me write up the test quickly
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rimhajal If online tests passes, this should be good to go. As soon as it is merged, we have to register the new version
No description provided.