Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
R
R - Mortality Tables
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
10
Issues
10
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
R
R - Mortality Tables
Commits
6ba1d2d7
Commit
6ba1d2d7
authored
Apr 18, 2018
by
Reinhold Kainhofer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mortalityTable: Add data slot, store raw data of whittaker graduatino; Fix wrong NULL check
parent
3a1c3eea
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
3 deletions
+10
-3
R/mortalityTable.R
R/mortalityTable.R
+7
-2
R/whittaker.mortalityTable.R
R/whittaker.mortalityTable.R
+3
-1
No files found.
R/mortalityTable.R
View file @
6ba1d2d7
...
...
@@ -19,6 +19,9 @@
#' to give the user a way to modify the final probabilities
#' @slot loading Additional security loading on the resulting table (single numeric
#' value, e.g. 0.05 adds 5\% security margin to the probabilities)
#' @slot data Placeholder list to make it possible to store any kind of data
#' associated with the object inside the object (e.g. the underlying
#' data used to derive the death probabilities, parameters for adjustment, etc.)
#'
#' @export mortalityTable
#' @exportClass mortalityTable
...
...
@@ -28,13 +31,15 @@ mortalityTable = setClass(
name
=
"character"
,
baseYear
=
"numeric"
,
loading
=
"numeric"
,
modification
=
"function"
modification
=
"function"
,
data
=
"list"
),
prototype
=
list
(
name
=
"Actuarial Mortality Table"
,
baseYear
=
0
,
loading
=
0
,
modification
=
identity
modification
=
identity
,
data
=
list
()
),
contains
=
"VIRTUAL"
)
R/whittaker.mortalityTable.R
View file @
6ba1d2d7
...
...
@@ -80,7 +80,7 @@ whittaker.mortalityTable = function(table, lambda = 10, d = 2, name.postfix = ",
ages
=
table
@
ages
if
(
missing
(
weights
)
||
is.null
(
weights
))
{
if
(
is.n
a
(
table
@
exposures
)
||
is.null
(
table
@
exposures
))
{
if
(
is.n
ull
(
table
@
exposures
)
||
is.na
(
table
@
exposures
))
{
weights
=
rep
(
1
,
length
(
ages
))
}
else
{
weights
=
table
@
exposures
...
...
@@ -114,6 +114,8 @@ whittaker.mortalityTable = function(table, lambda = 10, d = 2, name.postfix = ",
# above the last raw probability to NA
probsToClear
=
(
cumsum
(
!
is.na
(
orig.probs
))
==
0
)
|
(
rev
(
cumsum
(
rev
(
!
is.na
(
orig.probs
))))
==
0
)
probs.smooth
[
probsToClear
]
=
NA_real_
table
@
data
$
rawProbs
=
orig.probs
table
@
data
$
whittaker
=
list
(
weights
=
weights
)
table
@
deathProbs
=
probs.smooth
table
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment