Prepare_data {wcox}R Documentation

Prepare data for weight calculation using the population incidence.

Description

This function prepares the sample data for weight calculation using external information, i.e. the incidence in the population.

Usage

Prepare_data(dat, population_incidence, breaks)

Arguments

dat

Data.frame with one row per individual which at least includes a column d with event indicator (1 for event, 0 for censored), a column y with event/censoring time.

population_incidence

A vector (in combination with breaks) or a data.frame (columns 1) 'start age group', 2) 'end age group', 3)'S_pop') with population incidence per 100,000 per interval k.

breaks

Cut-points for the (age/time) groups. Only needed when population_incidence is a vector.

Details

Weights are based on a comparison between the survival between sample and population. Therefore, besides the sample data, the population incidence rate (per 100 000) is needed as input, as well as the cut-offs of the (age/time-to-event) groups for which this is available, unless this is provided in a data.frame.

Value

Data.frame ready for weight calculation using function 'Calculate_weights()': one row per individual and a.o. columns id unique ID; d non-censoring indicator; k interval of (age) group; S_k population interval-based proportion of individuals experiencing the event in intervals later than k; S_k. sample proportion of individuals experiencing the event in intervals later than k.


[Package wcox version 1.0 Index]