Approximate the likelihood function using a parametric (normal, skew-normal, or custom parametric), or grid approximation. The approximation does not reveal person-level information, and can therefore be shared among data sites. When counts are low, a normal approximation might not be appropriate.

approximateLikelihood(
  cyclopsFit,
  parameter = 1,
  approximation = "custom",
  bounds = c(log(0.1), log(10))
)

Arguments

cyclopsFit

A model fitted using the Cyclops::fitCyclopsModel() function.

parameter

The parameter in the cyclopsFit object to profile.

approximation

The type of approximation. Valid options are 'normal', 'skew normal', 'custom', 'grid', or 'adaptive grid'.

bounds

The bounds on the effect size used to fit the approximation.

Value

A vector of parameters of the likelihood approximation.

Examples

# Simulate some data for this example:
populations <- simulatePopulations()

cyclopsData <- Cyclops::createCyclopsData(Surv(time, y) ~ x + strata(stratumId),
  data = populations[[1]],
  modelType = "cox"
)
#> as(<numLike>, "dgeMatrix") is deprecated since Matrix 1.5-0; do as(as(as(., "dMatrix"), "generalMatrix"), "unpackedMatrix") instead
cyclopsFit <- Cyclops::fitCyclopsModel(cyclopsData)
approximation <- approximateLikelihood(cyclopsFit, "x")
approximation
#>           mu    sigma     gamma
#> 1 -0.9407448 1.053647 0.2303309

# (Estimates in this example will vary due to the random simulation)