recruitment_uniform {SimNPH}R Documentation

Add recruitment time to Dataset

Description

Add recruitment time to Dataset

Apply Administrative Censoring After Fixed Time

Apply Administrative Censoring After Fixed Number of Events

Usage

recruitment_uniform(
  dat,
  recruitment_until,
  recruitment_from = 0,
  discrete = TRUE
)

admin_censoring_time(dat, followup, keep_non_recruited = FALSE)

admin_censoring_events(
  dat,
  events,
  keep_non_recruited = FALSE,
  on_incomplete = "ignore"
)

Arguments

dat

a simulated dataset

recruitment_until

time of end of recruitment

recruitment_from

time of start of recruitment (defaults to 0)

discrete

should the recruitment time be rounded to full days?

followup

followup time

keep_non_recruited

should patients recruited after end of study be kept

events

number of events after which the dataset is analyzed

on_incomplete

what to do if there are fewer events than planned "ignore","warn","stop"

Details

The Dataset hast to include a column rec_time containing the recruitment time as well as the columns with the event times t and a column with the event indicator evt.

Times and event indicaotrs for patients recruited after followup are set to NA.

The Dataset hast to include a column rec_time containing the recruitment time as well as the columns with the event times t and a column with the event indicator evt.

Times and event indicaotrs for patients recruited after followup are set to NA.

If there are less events than planned for study end on_incomplete defines what should be done. "ignore" simply returns the dataset with the maximum of the observed times as followup. "warn" does the same but gives a warning. "stop" stopps with an error.

Value

Returns the dataset with added recruitment times.

Returns the dataset with administrative censoring after follwup, adds the attribute followup with the followup time to the dataset.

Returns the dataset with administrative censoring after events events, adds the attribute followup with the followup time to the dataset.

Functions

Examples

dat <- data.frame(t=c(0, 1, 2), trt=c(FALSE, FALSE, TRUE))
recruitment_uniform(dat, 7, 0)
dat <- data.frame(
  t = 1:10,
  rec_time = rep(1:5, each=2),
  trt = rep(c(TRUE, FALSE), times=5),
  evt = rep(TRUE, times=10)
)
dat

admin_censoring_time(dat, 4)
admin_censoring_time(dat, 4, keep_non_recruited = TRUE)

dat_censored <- admin_censoring_time(dat, 5)
attr(dat_censored, "followup")
dat <- data.frame(
  t = 1:10,
  rec_time = rep(2*(1:5), each=2),
  trt = rep(c(TRUE, FALSE), times=5),
  evt = rep(TRUE, times=10)
)
dat

admin_censoring_events(dat, 4)
admin_censoring_events(dat, 4, keep_non_recruited = TRUE)

dat_censored <- admin_censoring_events(dat, 4)
attr(dat_censored, "followup")

[Package SimNPH version 0.5.5 Index]