Skip to contents

Estimate point prevalence

Usage

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

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 or the cohort names of the denominator cohorts of interest. If NULL all cohorts will be considered in the analysis.

outcomeCohortId

The cohort definition ids or the cohort names 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).

Value

Point prevalence estimates

Examples

# \donttest{
cdm <- mockIncidencePrevalence(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: 649 × 13
#>    result_id cdm_name group_name            group_level strata_name strata_level
#>        <int> <chr>    <chr>                 <chr>       <chr>       <chr>       
#>  1         1 mock     denominator_cohort_n… denominato… overall     overall     
#>  2         1 mock     denominator_cohort_n… denominato… overall     overall     
#>  3         1 mock     denominator_cohort_n… denominato… overall     overall     
#>  4         1 mock     denominator_cohort_n… denominato… overall     overall     
#>  5         1 mock     denominator_cohort_n… denominato… overall     overall     
#>  6         1 mock     denominator_cohort_n… denominato… overall     overall     
#>  7         1 mock     denominator_cohort_n… denominato… overall     overall     
#>  8         1 mock     denominator_cohort_n… denominato… overall     overall     
#>  9         1 mock     denominator_cohort_n… denominato… overall     overall     
#> 10         1 mock     denominator_cohort_n… denominato… overall     overall     
#> # ℹ 639 more rows
#> # ℹ 7 more variables: variable_name <chr>, variable_level <chr>,
#> #   estimate_name <chr>, estimate_type <chr>, estimate_value <chr>,
#> #   additional_name <chr>, additional_level <chr>
# }