Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
R
R - Mortality Tables
Commits
3701b986
Commit
3701b986
authored
Jun 01, 2018
by
Reinhold Kainhofer
Browse files
Switch mT.fitExtrapolationLaw to use the qx rather than the Dx and Ex to fit
parent
d67a3d53
Changes
1
Hide whitespace changes
Inline
Side-by-side
R/utilityFunctions.R
View file @
3701b986
...
@@ -186,23 +186,23 @@ mT.fitExtrapolationLaw = function(table, method = "LF2", law = "HP",
...
@@ -186,23 +186,23 @@ mT.fitExtrapolationLaw = function(table, method = "LF2", law = "HP",
stop
(
"First argument must be a mortalityTable."
)
stop
(
"First argument must be a mortalityTable."
)
ages
=
ages
(
table
)
ages
=
ages
(
table
)
if
(
!
is.null
(
table
@
exposures
)
&&
!
is.na
(
table
@
exposures
))
{
#
if (!is.null(table@exposures) && !is.na(table@exposures)) {
Ex
=
table
@
exposures
#
Ex = table@exposures
qx
=
table
@
deathProbs
#
qx = table@deathProbs
# if (!is.null(table@data$deaths)) {
# if (!is.null(table@data$deaths)) {
# Dx = table@data$deaths
# Dx = table@data$deaths
# } else {
# } else {
# Dx = table@deathProbs * Ex
# Dx = table@deathProbs * Ex
# }
# }
}
else
{
#
} else {
Ex
=
rep
(
1
,
length
(
ages
))
#
Ex = rep(1, length(ages))
# Dx = table@deathProbs
# Dx = table@deathProbs
qx
=
table
@
deathProbs
#
qx = table@deathProbs
}
#
}
table
=
mT.fillAges
(
table
,
neededAges
=
union
(
ages
,
extrapolate
),
fill
=
0
)
table
=
mT.fillAges
(
table
,
neededAges
=
union
(
ages
,
extrapolate
),
fill
=
0
)
fitted
=
fitExtrapolationLaw
(
fitted
=
fitExtrapolationLaw
(
data
=
table
@
deathProbs
,
ages
=
ages
(
table
),
data
=
table
@
deathProbs
,
ages
=
ages
(
table
),
qx
=
qx
,
Ex
=
Ex
,
data.ages
=
ages
,
qx
=
table
@
deathProbs
,
data.ages
=
ages
,
method
=
method
,
law
=
law
,
method
=
method
,
law
=
law
,
fit
=
fit
,
extrapolate
=
extrapolate
,
fit
=
fit
,
extrapolate
=
extrapolate
,
fadeIn
=
fadeIn
,
fadeOut
=
fadeOut
,
fadeIn
=
fadeIn
,
fadeOut
=
fadeOut
,
...
...
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