clogit_with_tryCatch: Wrapper function of survival::clogit

View source: R/utils.R

clogit_with_tryCatchR Documentation

Wrapper function of survival::clogit

Description

When model fitting failed, a more useful message would show.

Usage

clogit_with_tryCatch(formula, data, ...)

Arguments

formula

Model formula.

data

data frame.

...

further parameters to be added to survival::clogit.

Value

When model fitting is successful, an object of class "clogit".
When model fitting failed, an error message is shown.

Examples

## Not run: 
library(dplyr)
adrs_local <- tern_ex_adrs %>%
  dplyr::filter(ARMCD %in% c("ARM A", "ARM B")) %>%
  dplyr::mutate(
    RSP = dplyr::case_when(AVALC %in% c("PR", "CR") ~ 1, TRUE ~ 0),
    ARMBIN = droplevels(ARMCD)
  )
dta <- adrs_local
dta <- dta[sample(nrow(dta)), ]
mod <- clogit_with_tryCatch(formula = RSP ~ ARMBIN * AGE + strata(STRATA1), data = dta)

## End(Not run)


tern documentation built on June 20, 2025, 9:08 a.m.