getGImpute: Add theimputed infection times to an existing dataframe.

View source: R/intCens.R

getGImputeR Documentation

Add theimputed infection times to an existing dataframe.

Description

Adds the ith column of imputed infection times from gImpute to an existing dataset.

Usage

getGImpute(rtdat, gdat, i)

Arguments

rtdat

An existing dataset generated from getRTData.

gdat

The imputed dateset from gImpute.

i

The ith imputed infection time in gdat.

Value

data.frame

Examples

# See full examples at https://github.com/vando026/ahri/wiki/6-G-Imputation
# install.packages(system.file("IntCens_0.2.tar.gz", package = "ahri"), repos = NULL, type = 'source')
library(IntCens)
data(gdat_demo)
data(rtdat_demo)
home <- file.path('/home/alain/Seafile/AHRI_Data')
write.table(gdat_demo, file=file.path(home, "intcens/input_data.txt"),
  row.names=FALSE, quote=FALSE)
unireg(input = file.path(home, "intcens/input_data.txt"),
  output = file.path(home, "intcens/res_dat.txt"),
  model = "(Time, sero_event) = Age0 + Age2 + EverCircum",
  subject_id = "IIntID", convergence_threshold=0.01, r = 1.0)
ureg_res <- readUniRegResults(
  File=file.path(home, "intcens/res_dat.txt"))
Args <- setArgs(
  Years=c(2005:2018), nSim=50,
  Age=list(Mal=c(15, 54)))
gdates <- gImpute(gdat_demo, ureg_res, nSim=Args$nSim)
gdat_ex <- getGImpute(rtdat_demo, gdates, 1)
gdat_ex[gdat_ex$sero_event==1, ]

vando026/ahri documentation built on Aug. 10, 2024, 3:20 p.m.