MakePatientRates: Makes matrix of patient-specific birth, shift, and death...

Description Usage Arguments Value Examples

View source: R/bsd_package.R

Description

This function returns a matrix containing the birth, shift, and death rates of each patient. The rates are calculated based on the log-linear relationship between regression coefficients \mathbf{β} = (\mathbf{β^λ}, \mathbf{β}^ν, \mathbf{β}^μ) and covariates \mathbf{z_p} in the pth column of the design matrix given by \log(λ_p) = \mathbfβ^λ \cdot \mathbf{z_p}, \log(ν_p) = \mathbfβ^ν \cdot \mathbf{z_p}, \log(μ_p) = \mathbfβ^μ \cdot \mathbf{z_p}

Usage

1
  MakePatientRates(patients.design, betaVec)

Arguments

patients.design

A n \times m matrix, where n is number of covariates (including intercept) in the model and m is number of patients

betaVec

The vector \mathbfβ of regression coefficients. Note this function assumes that \mathbfβ^λ, \mathbfβ^ν, \mathbfβ^μ are equal in length. That is, each rate depends on the same number of covariates

Value

A 3 \times m matrix where m is the number of patients, and rows correspond to birth, shift, and death rates respectively.

Examples

1
2
3
4
5
num.patients = 20
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)
MakePatientRates(patients.design, betas)

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