-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCodeToRun.R
More file actions
64 lines (50 loc) · 1.72 KB
/
CodeToRun.R
File metadata and controls
64 lines (50 loc) · 1.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
library(IncidencePrevalence)
library(IncidencePrevalenceReport)
library(dplyr)
library(tidyr)
library(ggplot2)
# Example with mock data
cdm <- generate_mock_incidence_prevalence_db(sample_size = 50000,
out_pre = 0.5)
# Denominator populations
dpop <- collect_denominator_pops(cdm = cdm,
study_start_date = as.Date("2008-01-01"),
study_end_date = as.Date("2012-01-01"),
study_age_stratas = list(c(18,65)),
study_sex_stratas = "Female",
study_days_prior_history = 365)
# Adding denominator population to cdm object
cdm$denominator <- dpop$denominator_population
# Prevalence calculation
prevalence <- collect_pop_prevalence(
cdm = cdm,
table_name_denominator = "denominator",
cohort_ids_denominator_pops = "1",
table_name_outcomes = "outcome",
cohort_ids_outcomes = "1",
time_intervals="Years",
type = "point",
minimum_cell_count = 0
)
# Incidence calculation
incidence <- collect_pop_incidence(
cdm = cdm,
table_name_denominator = "denominator",
table_name_outcomes = "outcome",
cohort_ids_outcomes = "1",
cohort_ids_denominator_pops = "1",
time_interval = c("Years"),
outcome_washout_windows = 180
)
##### STUDY REPORT LAUNCH
title <- "Incidence Prevalence Report"
author <- "CESAR BARBOZA"
denominator <- dpop
prevalence <- prevalence
incidence <- incidence
## RUN
reportIncidencePrevalence(title,
author,
denominator,
prevalence,
incidence)