Skip to content
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

Burnham model - Missing Year/Cohort in Design data list #7

Open
gabrielbouleau opened this issue Jan 28, 2021 · 0 comments
Open

Burnham model - Missing Year/Cohort in Design data list #7

gabrielbouleau opened this issue Jan 28, 2021 · 0 comments

Comments

@gabrielbouleau
Copy link

gabrielbouleau commented Jan 28, 2021

Hi!

I have an issue when I try to build a Burnham model with LD data.

(Please note that the registration on the Phidot forum are closed, hence why I posted my issue here. Feel free to move it to the appropriate place)

When I build the ddl object, there seems to miss every other year in the Cohort/Year colums. This issue follows when building models and cause the PIMS matrices to have an extra parameters for the cohort missing.

See below a reproducible example with a subset of my data :

library(RMark)
#> This is RMark 2.2.7
#>  Documentation available at http://www.phidot.org/software/mark/rmark/RMarkDocumentation.zip

# Here is a subset of the first 10 years of the data
# The data have the format LDLDLD where L = capture/alive encounter
# and D = dead encounter. The column freq is this capture history
# frequency in the dataset

data <- tibble::tribble(
  ~ch, ~freq,
  "11000000000000000000", 1L,
  "10000000010000000000", 1L,
  "10000000000000000000", 3L,
  "00100000000100000000", 1L,
  "00100000000000000100", 1L,
  "00100000000000000000", 3L,
  "00001000000000000000", 14L,
  "00000010000100000000", 1L,
  "00000010000000000100", 1L,
  "00000010000000000000", 8L,
  "00000000100001000000", 2L,
  "00000000100000010000", 1L,
  "00000000100000000100", 1L,
  "00000000100000000000", 13L,
  "00000000001000010000", 1L,
  "00000000001000000000", 10L,
  "00000000000011000000", 2L,
  "00000000000010010000", 1L,
  "00000000000010000100", 1L,
  "00000000000010000000", 17L,
  "00000000000000101000", 1L,
  "00000000000000100100", 1L,
  "00000000000000100000", 13L,
  "00000000000000001000", 16L,
  "00000000000000000011", 2L,
  "00000000000000000010", 16L
)

# Process data into a Burnham life-dead model
data.proc <- process.data(
  data = data,
  model = "Burnham",
  begin.time = 1960
)

# Create design data list
data.ddl <- make.design.data(data.proc,
  remove.unused = T
)

# Where chekcing the desing data list, we notice that half
# the years are missing from the table. Upon running the model,
# this create a problem in the PIMS matrix
unique(data.ddl$S$Cohort)
#> [1] 0 2 4 6 8
data.ddl$S
#>    par.index model.index group cohort age time occ.cohort Cohort Age Time
#> 1          1           1     1   1960   0 1960          1      0   0    0
#> 2          2           2     1   1960   1 1961          1      0   1    1
#> 3          3           3     1   1960   2 1962          1      0   2    2
#> 4          4           4     1   1960   3 1963          1      0   3    3
#> 5          5           5     1   1960   4 1964          1      0   4    4
#> 6          6           6     1   1960   5 1965          1      0   5    5
#> 7          7           7     1   1960   6 1966          1      0   6    6
#> 8          8           8     1   1960   7 1967          1      0   7    7
#> 9          9           9     1   1960   8 1968          1      0   8    8
#> 10        10          10     1   1960   9 1969          1      0   9    9
#> 20        20          20     1   1962   0 1962          3      2   0    2
#> 21        21          21     1   1962   1 1963          3      2   1    3
#> 22        22          22     1   1962   2 1964          3      2   2    4
#> 23        23          23     1   1962   3 1965          3      2   3    5
#> 24        24          24     1   1962   4 1966          3      2   4    6
#> 25        25          25     1   1962   5 1967          3      2   5    7
#> 26        26          26     1   1962   6 1968          3      2   6    8
#> 27        27          27     1   1962   7 1969          3      2   7    9
#> 35        35          35     1   1964   0 1964          5      4   0    4
#> 36        36          36     1   1964   1 1965          5      4   1    5
#> 37        37          37     1   1964   2 1966          5      4   2    6
#> 38        38          38     1   1964   3 1967          5      4   3    7
#> 39        39          39     1   1964   4 1968          5      4   4    8
#> 40        40          40     1   1964   5 1969          5      4   5    9
#> 46        46          46     1   1966   0 1966          7      6   0    6
#> 47        47          47     1   1966   1 1967          7      6   1    7
#> 48        48          48     1   1966   2 1968          7      6   2    8
#> 49        49          49     1   1966   3 1969          7      6   3    9
#> 53        53          53     1   1968   0 1968          9      8   0    8
#> 54        54          54     1   1968   1 1969          9      8   1    9

Created on 2021-01-28 by the reprex package (v1.0.0)

Session info
sessioninfo::session_info()
#> - Session info ---------------------------------------------------------------
#>  setting  value                       
#>  version  R version 4.0.3 (2020-10-10)
#>  os       Windows 10 x64              
#>  system   x86_64, mingw32             
#>  ui       RTerm                       
#>  language (EN)                        
#>  collate  English_Canada.1252         
#>  ctype    English_Canada.1252         
#>  tz       America/New_York            
#>  date     2021-01-28                  
#> 
#> - Packages -------------------------------------------------------------------
#>  package     * version date       lib source        
#>  assertthat    0.2.1   2019-03-21 [1] CRAN (R 4.0.0)
#>  backports     1.2.0   2020-11-02 [1] CRAN (R 4.0.3)
#>  cli           2.2.0   2020-11-20 [1] CRAN (R 4.0.3)
#>  coda          0.19-4  2020-09-30 [1] CRAN (R 4.0.3)
#>  crayon        1.3.4   2017-09-16 [1] CRAN (R 4.0.0)
#>  digest        0.6.27  2020-10-24 [1] CRAN (R 4.0.3)
#>  ellipsis      0.3.1   2020-05-15 [1] CRAN (R 4.0.3)
#>  evaluate      0.14    2019-05-28 [1] CRAN (R 4.0.3)
#>  expm          0.999-6 2021-01-13 [1] CRAN (R 4.0.3)
#>  fansi         0.4.1   2020-01-08 [1] CRAN (R 4.0.0)
#>  fs            1.5.0   2020-07-31 [1] CRAN (R 4.0.3)
#>  glue          1.4.2   2020-08-27 [1] CRAN (R 4.0.3)
#>  highr         0.8     2019-03-20 [1] CRAN (R 4.0.3)
#>  htmltools     0.5.0   2020-06-16 [1] CRAN (R 4.0.2)
#>  knitr         1.30    2020-09-22 [1] CRAN (R 4.0.3)
#>  lattice       0.20-41 2020-04-02 [2] CRAN (R 4.0.3)
#>  lifecycle     0.2.0   2020-03-06 [1] CRAN (R 4.0.0)
#>  magrittr      2.0.1   2020-11-17 [1] CRAN (R 4.0.3)
#>  Matrix        1.2-18  2019-11-27 [2] CRAN (R 4.0.3)
#>  matrixcalc    1.0-3   2012-09-15 [1] CRAN (R 4.0.3)
#>  msm           1.6.8   2019-12-16 [1] CRAN (R 4.0.3)
#>  mvtnorm       1.1-1   2020-06-09 [1] CRAN (R 4.0.3)
#>  pillar        1.4.7   2020-11-20 [1] CRAN (R 4.0.3)
#>  pkgconfig     2.0.3   2019-09-22 [1] CRAN (R 4.0.0)
#>  purrr         0.3.4   2020-04-17 [1] CRAN (R 4.0.3)
#>  R.cache       0.14.0  2019-12-06 [1] CRAN (R 4.0.3)
#>  R.methodsS3   1.8.1   2020-08-26 [1] CRAN (R 4.0.3)
#>  R.oo          1.24.0  2020-08-26 [1] CRAN (R 4.0.3)
#>  R.utils       2.10.1  2020-08-26 [1] CRAN (R 4.0.3)
#>  rematch2      2.1.2   2020-05-01 [1] CRAN (R 4.0.2)
#>  reprex        1.0.0   2021-01-27 [1] CRAN (R 4.0.3)
#>  rlang         0.4.8   2020-10-08 [1] CRAN (R 4.0.3)
#>  RMark       * 2.2.7   2019-11-06 [1] CRAN (R 4.0.3)
#>  rmarkdown     2.5     2020-10-21 [1] CRAN (R 4.0.2)
#>  rstudioapi    0.13    2020-11-12 [1] CRAN (R 4.0.3)
#>  sessioninfo   1.1.1   2018-11-05 [1] CRAN (R 4.0.2)
#>  stringi       1.5.3   2020-09-09 [1] CRAN (R 4.0.3)
#>  stringr       1.4.0   2019-02-10 [1] CRAN (R 4.0.3)
#>  styler        1.3.2   2020-02-23 [1] CRAN (R 4.0.3)
#>  survival      3.2-7   2020-09-28 [2] CRAN (R 4.0.3)
#>  tibble        3.0.4   2020-10-12 [1] CRAN (R 4.0.3)
#>  vctrs         0.3.4   2020-08-29 [1] CRAN (R 4.0.3)
#>  withr         2.3.0   2020-09-22 [1] CRAN (R 4.0.3)
#>  xfun          0.19    2020-10-30 [1] CRAN (R 4.0.3)
#>  yaml          2.2.1   2020-02-01 [1] CRAN (R 4.0.3)
#> 
#> [1] C:/Users/gabri/Documents/R/win-library/4.0
#> [2] C:/Program Files/R/R-4.0.3/library
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant