Skip to content

JensXII/MOMO

 
 

Repository files navigation

MOMOpack for R

MOMO 2024.06.04

Using restricted cubic splines in the baseline estimation (not recommend)

MOMO 2024.03.18

Corrections to accommodate Linux

MOMO 2023.05.08

Exclusion of the COVID-19 pandemic years, 2020-2022, from baseline estimation

MOMO 2023.05.08

Included the DropPeriods option for periods to be excluded in the baseline estimation.

Install latest version: devtools::install_github("JensXII/MOMO") Install original version: devtools::install_github("JensXII/MOMO", ref = "2020.4.17")

MOMO 2020.9.3

Spring weeks of 2020, COVID-19, permanently excluded from baseline estimation

MOMO 2020.4.17

Ydrop and Wdrop as parameters glmnet removed from list of dependencies

MOMO 2018.8.24

  • There are now more options for extracting data from inside your MoMo run. Previously only MOMO::dataExport$toSave was available, however, now there is also MOMO::dataExport$aggr, MOMO::dataExport$aggr_fullDelay, and MOMO::dataExport$aggr_delay

MOMO 2018.8.23

  • The new delay correction that Jens developed in December 2017 is now available. This can be chosen by delayVersion="2017-12", or the original delay correction can be chosen by delayVersion="original" (default).

Initial: MOMO 2017.12.14

  • This is a full port of the Stata A-MOMO package to R. The code used to analyze mortality data for the EuroMOMO project.

How to install

Please use package:

devtools::install_github("JensXII/MOMO")

Basic example

SetOpts(
  DoA=as.Date("2013-12-31"),
  DoPR=as.Date("2008-1-1"),
  WStart=1,
  WEnd=52,
  country = "Denmark",
  source = "SSI",
  MFILE = "DoD_DoR.txt",
  HFILE = "holidays.txt",
  INPUTDIR = system.file("testdata", package="MOMO"),
  WDIR = tempdir(),
  back = 3,
  WWW = 290,
  Ysum = 2013,
  Wsum = 40,
  USEglm2 = TRUE,
  useAUTOMN = TRUE,
  datesISO = FALSE,
  plotGraphs = TRUE,
  delayVersion = "2017-12",
  MOMOgroups = list(`0to14` = "0 <= age & age <= 14",
                    `15to44` = "15 <= age & age <= 44",
                    `45to64` = "45 <= age & age <= 64",
                    `65P` = "age >= 65 & !is.na(age)",
                    `65to74` = "65 <= age & age <= 74",
                    `75to84` = "75 <= age & age <= 84",
                    `85P` = "age >= 85 & !is.na(age)",
                    `Total` = "age >= 0 | is.na(age)"
  ),
  MOMOmodels = c(`0to14` = "LINE",
                 `15to44` = "LINE_SIN",
                 `45to64` = "LINE_SIN",
                 `65P` = "LINE_SIN",
                 `65to74` = "LINE_SIN",
                 `75to84` = "LINE_SIN",
                 `85P` = "LINE_SIN",
                 `Total` = "LINE_SIN"
  ),
  Ydrop = 9999,
  Wdrop = 99,
  verbose = TRUE
)

RunMOMO()

Another example using MDATA and HDATA instead of MFILE and HFILE

MDATA <- as.data.frame(data.table::fread(file.path(system.file("testdata",package="MOMO"),"DoD_DoR.txt")))
HDATA <- as.data.frame(data.table::fread(file.path(system.file("testdata",package="MOMO"),"holidays.txt")))

SetOpts(
  DoA=as.Date("2013-12-31"),
  DoPR=as.Date("2008-1-1"),
  WStart=1,
  WEnd=52,
  country = "Denmark",
  source = "SSI",
  MDATA = MDATA,
  HDATA = HDATA,
  WDIR = tempdir(),
  back = 3,
  WWW = 290,
  Ysum = 2013,
  Wsum = 40,
  USEglm2 = TRUE,
  useAUTOMN = TRUE,
  datesISO = FALSE,
  plotGraphs = TRUE,
  delayVersion = "2017-12",
  MOMOgroups = list(`0to14` = "0 <= age & age <= 14",
                    `15to44` = "15 <= age & age <= 44",
                    `45to64` = "45 <= age & age <= 64",
                    `65P` = "age >= 65 & !is.na(age)",
                    `65to74` = "65 <= age & age <= 74",
                    `75to84` = "75 <= age & age <= 84",
                    `85P` = "age >= 85 & !is.na(age)",
                    `Total` = "age >= 0 | is.na(age)"
  ),
  MOMOmodels = c(`0to14` = "LINE",
                 `15to44` = "LINE_SIN",
                 `45to64` = "LINE_SIN",
                 `65P` = "LINE_SIN",
                 `65to74` = "LINE_SIN",
                 `75to84` = "LINE_SIN",
                 `85P` = "LINE_SIN",
                 `Total` = "LINE_SIN"
  ),
  Ydrop = 9999,
  Wdrop = 99,
  verbose = TRUE
)

RunMOMO()

Delay corrections available

Delay correction Description
original ???
sincos original+sin52+cos52
richard Interacts WR with categorical YoDi, includes closed, sin52, and cos52nb2 ~ WRXX*as.factor(YoDi) + closed + sin52 + cos52

original

???

sincos

???

richard

nb2 ~ WRXX*as.factor(YoDi) + closed + sin52 + cos52

About

No description, website, or topics provided.

Resources

Contributing

Stars

0 stars

Watchers

2 watching

Forks

Packages

 
 
 

Contributors

Languages

  • R 98.9%
  • Shell 1.1%