MakePatientData: Generates synthetic patient data for inference in discretely...

Description Usage Arguments Details Value Examples

View source: R/bsd_package.R

Description

MakePatientData is the main function for generating a synthetic dataset with covariates. It simulates observations from a birth-shift-death process for a number of synthetic "patients", using ransim.N.true. This provides data for simulation studies toward assessing inference in a panel data setting, with rates depending on multiple covariates.

Usage

1
  MakePatientData(t, num.patients, patients.rates)

Arguments

t

A number giving the observation interval length

num.patients

An integer, the number of synthetic patients

patients.rates

A matrix in the format returned by MakePatientRates

Details

Each observation interval has a common fixed length given by the argument t. For each patient, between 2 and 6 observation intervals are generated, and each begins with between 2 and 12 initial particles. These numbers are initialized uniformly at random, and passed in as arguments to ransim.N.true, with the true rates set to the corresponding column of patients.rates.

Value

A 5 \times m matrix where m is the number of total observation intervals generated. The first row corresponds to the patient ID, the second row gives the initial number of particles for that observation interval, the third through fifth column are in the format returned by ransim.N.true

Examples

1
2
3
4
5
6
num.patients = 10; t = .4
patients.design <- PatientDesignExample(num.patients)
beta.lam <- c(log(8), log(.6)); beta.v <- c( log(.5), log(.7)); beta.mu <- c(log(.8), log(.8))
betas <- c(beta.lam,beta.v,beta.mu)
patients.rates <- MakePatientRates(patients.design, betas)
MakePatientData(t, num.patients, patients.rates)

jasonxu90/bdsem documentation built on May 18, 2019, 5:54 p.m.