## ----include = FALSE----------------------------------------------------------
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.width = 5,
  fig.height = 3,
  fig.align = "center"
)

## ----setup--------------------------------------------------------------------
library(survdt)

## -----------------------------------------------------------------------------
y <- Survdt(aids$incu, aids$ltrunc, aids$rtrunc)
head(y)
plot(y)

## -----------------------------------------------------------------------------
npfit <- npmle(Survdt(incu, ltrunc, rtrunc), data = aids, cumhaz = TRUE)
npfit

plot(npfit)

## -----------------------------------------------------------------------------
plot(npfit, target = "cumhaz")

## -----------------------------------------------------------------------------
summary(aids$age_gp)

## -----------------------------------------------------------------------------
agetest <- test_samplediff_indtrunc(Survdt(incu, ltrunc, rtrunc) ~ age_gp, 
                                    data = aids,
                                    restr_times = c(NA, 70))
agetest

## ----fig.height = 3.5---------------------------------------------------------
plot(agetest)

## -----------------------------------------------------------------------------
test_quasiindep_ctau(Survdt(incu, ltrunc, rtrunc), data = aids)

## ----fig.height=3.5-----------------------------------------------------------
igtest_prob <- test_ignorability_indtrunc(npfit, test_type = "sel_prob")
igtest_prob
plot(igtest_prob)

igtest_cdf <- test_ignorability_indtrunc(npfit, test_type = "cdf", 
                                         restr_times = c(NA, 80))
igtest_cdf
plot(igtest_cdf)

## ----fig.height=3.5-----------------------------------------------------------
igtest_cdf2 <- test_ignorability_indtrunc(npfit, test_type = "cdf")
igtest_cdf2
plot(igtest_cdf2)

## -----------------------------------------------------------------------------
plot(npfit, target = "sel_prob")

