Learn R Programming

rprev (version 0.2.3)

prevalence_counted: Count prevalence from registry data.

Description

Counts contribution to prevalence at a specific index from each year of a registry. A person is included as contributing to disease prevalence if they are incident within the specified time-span, and are either alive or censored at the index date. The rationale for including censored cases in prevalence estimation is that such cases have typically been lost to follow-up, and are often more likely to have been alive at the index date than not.

Usage

prevalence_counted(entry, eventdate, status, index_date = NULL, num_reg_years = NULL, start = NULL)

Arguments

entry
Vector of diagnosis dates for each patient in the registry in the format YYYY-MM-DD.
eventdate
Vector of dates corresponding to the indicator variable in the format YYYY-MM-DD.
status
Vector of binary values indicating if an event has occurred for each patient in the registry. entry, eventdate, and status must all have the same length.
index_date
The date at which to estimate point prevalence. Defaults to the latest registry entry date.
num_reg_years
The number of years of the registry for which incidence is to be calculated. Defaults to using all available complete years. Note that if more registry years are supplied than the number of years to estimate prevalence for, the survival data from the surplus registry years are still involved in the survival model fitting.
start
Deprecated: Use index_date instead and specify the number of years of registry data to use with num_reg_years. Date from which incident cases are included in the format YYYY-MM-DD. Defaults to the earliest entry date. This value is now inferred by counting back num_reg_years years of registry data from the index_date. and

Value

A vector of length equal to the number of complete years of registry data before index_date (given by num_reg_years), representing the number of incident cases in the corresponding year that contribute to the prevalence at the index date.

See Also

Other prevalence functions: prevalence_simulated, prevalence, test_prevalence_fit

Examples

Run this code
data(prevsim)

prevalence_counted(prevsim$entrydate,
                   prevsim$eventdate,
                   prevsim$status)

prevalence_counted(prevsim$entrydate,
                   prevsim$eventdate,
                   prevsim$status,
                   index_date="2012-01-30")

Run the code above in your browser using DataLab