Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Version 0.5.0
improved generator fltper
  • Loading branch information
walke committed Nov 22, 2019
1 parent 9f89547 commit 74c3c25
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 29 deletions.
6 changes: 3 additions & 3 deletions DESCRIPTION
@@ -1,8 +1,8 @@
Package: eoR
Type: Package
Title: Data Management Package (Exposure and Occurrence Data in R)
Version: 0.4.0
Date: 2019-11-07
Version: 0.5.0
Date: 2019-11-22
Authors@R: c(person("Rainer", "Walke", role = c("aut", "cre"),
email = "walke@demogr.mpg.de",
comment = c(ORCID = "0000-0002-4269-6531")))
Expand All @@ -23,4 +23,4 @@ Encoding: UTF-8
Depends: R (>= 3.2.0)
Imports: methods, data.table
LazyData: no
RoxygenNote: 6.1.1
RoxygenNote: 7.0.0
30 changes: 4 additions & 26 deletions tests/generator_DEUTNP.fltper_1x1m.R
Expand Up @@ -43,34 +43,12 @@ block3 <- function(mult) {

ltA[, px := 1 - qx][]

ltA[, lx := 100000 * cumprod(shift(px, 1L, fill=1, type="lag"))][]

# ltA[,pxlag := shift(px, 1L, type="lag")]
ltA[, dx := lx * qx]
ltA[, Lx := lx - ( 1 - ax ) * dx]

ltA[AgeLow==0, lx := 100000][]

for (x in seq(1,110)) {

ltA[AgeLow == x, lx := ltA[AgeLow == (x-1), lx] * ltA[AgeLow == (x-1), px]]

}

ltA[AgeLow == 110, dx := lx][]
ltA[AgeLow == 110, Lx := lx * ax][]

for (x in seq(109,0)) {

ltA[AgeLow == x, dx := lx * qx]
ltA[AgeLow == x, Lx := lx - ( 1 - ax ) * dx]

}

ltA[AgeLow == 110, Tx := Lx][]

for (x in seq(109,0)) {

ltA[AgeLow == x, Tx := ltA[AgeLow == (x+1), Tx] + Lx]

}
ltA[, Tx := rev(cumsum(rev(Lx)))]

ltA[, ex := Tx / lx][]

Expand Down

0 comments on commit 74c3c25

Please sign in to comment.