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 = "grid with gradients",
  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', 'adaptive grid', or 'grid with gradients'.

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.
#> Use 'as(as(as(., "dMatrix"), "generalMatrix"), "unpackedMatrix")' instead.
#> See help("Deprecated") and help("Matrix-deprecated").
cyclopsFit <- Cyclops::fitCyclopsModel(cyclopsData)
#> Warning: BLR convergence criterion failed; coefficient may be infinite
approximation <- approximateLikelihood(cyclopsFit, "x")
approximation
#>        point     value  derivative
#> 1 -2.3025851 -16.42905 -0.06928413
#> 2 -1.6447036 -16.49283 -0.13090344
#> 3 -0.9868222 -16.61222 -0.24271450
#> 4 -0.3289407 -16.82989 -0.43534046
#> 5  0.3289407 -17.20965 -0.73942484
#> 6  0.9868222 -17.82865 -1.15932035
#> 7  1.6447036 -18.74959 -1.64390824
#> 8  2.3025851 -19.98523 -2.10007041

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