Skip to contents

Estimate point prevalence

Usage

estimatePointPrevalence(
  cdm,
  denominatorTable,
  outcomeTable,
  denominatorCohortId = NULL,
  outcomeCohortId = NULL,
  interval = "years",
  timePoint = "start",
  strata = list(),
  includeOverallStrata = TRUE,
  minCellCount = 5,
  returnParticipants = FALSE
)

Arguments

cdm

A CDM reference object

denominatorTable

A cohort table with a set of denominator cohorts (for example, created using the generateDenominatorCohortSet() function).

outcomeTable

A cohort table in the cdm reference containing a set of outcome cohorts.

denominatorCohortId

The cohort definition ids of the denominator cohorts of interest. If NULL all cohorts will be considered in the analysis.

outcomeCohortId

The cohort definition ids of the outcome cohorts of interest. If NULL all cohorts will be considered in the analysis.

interval

Time intervals over which period prevalence is estimated. Can be "weeks", "months", "quarters", or "years". ISO weeks will be used for weeks. Calendar months, quarters, or years can be used as the period. If more than one option is chosen then results will be estimated for each chosen interval.

timePoint

where to compute the point prevalence

strata

Variables added to the denominator cohort table for which to stratify estimates.

includeOverallStrata

Whether to include an overall result as well as strata specific results (when strata has been specified).

minCellCount

Minimum number of events to report- results lower than this will be obscured. If NULL all results will be reported.

returnParticipants

Either TRUE or FALSE. If TRUE references to participants from the analysis will be returned allowing for further analysis. Note, if using permanent tables and returnParticipants is TRUE, one table per analysis will be kept in the cdm write schema.

Value

Point prevalence estimates

Examples

# \donttest{
cdm <- mockIncidencePrevalenceRef(sampleSize = 1000)
cdm <- generateDenominatorCohortSet(
  cdm = cdm, name = "denominator",
  cohortDateRange = c(as.Date("2008-01-01"), as.Date("2018-01-01"))
)
#>  Creating denominator cohorts
#>  Cohorts created in 0 min and 3 sec
estimatePointPrevalence(
  cdm = cdm,
  denominatorTable = "denominator",
  outcomeTable = "outcome",
  interval = "months"
)
#> Getting prevalence for analysis 1 of 1
#> Time taken: 0 mins and 1 secs
#> # A tibble: 121 × 29
#>    analysis_id prevalence_start_date prevalence_end_date n_cases n_population
#>    <chr>       <date>                <date>                <int>        <int>
#>  1 1           2008-01-01            2008-01-01                0          691
#>  2 1           2008-02-01            2008-02-01               NA          691
#>  3 1           2008-03-01            2008-03-01                0          690
#>  4 1           2008-04-01            2008-04-01                0          688
#>  5 1           2008-05-01            2008-05-01                0          685
#>  6 1           2008-06-01            2008-06-01                0          685
#>  7 1           2008-07-01            2008-07-01                0          684
#>  8 1           2008-08-01            2008-08-01                0          681
#>  9 1           2008-09-01            2008-09-01                0          681
#> 10 1           2008-10-01            2008-10-01                0          681
#> # ℹ 111 more rows
#> # ℹ 24 more variables: prevalence <dbl>, prevalence_95CI_lower <dbl>,
#> #   prevalence_95CI_upper <dbl>, population_obscured <chr>,
#> #   cases_obscured <chr>, result_obscured <chr>, outcome_cohort_id <int>,
#> #   outcome_cohort_name <chr>, analysis_type <chr>, analysis_interval <chr>,
#> #   analysis_complete_database_intervals <lgl>, analysis_time_point <chr>,
#> #   analysis_full_contribution <lgl>, analysis_min_cell_count <dbl>, …
# }