inst/doc/direct_approximation_vs_schoenfeld.R

## ----include = FALSE----------------------------------------------------------
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)

## ----setup--------------------------------------------------------------------
library(lrstat)

## -----------------------------------------------------------------------------
caltime(nevents = 40, accrualDuration = 12, accrualIntensity = 200/12,
        lambda1 = -log(1-0.2)/12, lambda2 = -log(1-0.4)/12, 
        followupTime = 100)

## -----------------------------------------------------------------------------
lrpower(kMax = 1, criticalValues = 1.96, accrualDuration = 12, 
        accrualIntensity = 200/12, lambda1 = -log(1-0.2)/12, 
        lambda2 = -log(1-0.4)/12,  followupTime = 1.63)

## -----------------------------------------------------------------------------
hazardRatio = log(1-0.2)/log(1-0.4)
pnorm(abs(log(hazardRatio))*sqrt(40/4) - qnorm(0.975))

## -----------------------------------------------------------------------------
lrsim(kMax = 1, criticalValues = 1.96, 
      accrualIntensity = 200/12, 
      lambda1 = -log(1-0.2)/12, lambda2 = -log(1-0.4)/12,
      accrualDuration = 12, 
      plannedEvents = 40, 
      maxNumberOfIterations = 10000, seed = 314159)

Try the lrstat package in your browser

Any scripts or data that you put into this service are public.

lrstat documentation built on Oct. 18, 2024, 9:06 a.m.