Cubic Hermite interpolation using both values and gradients to approximate a log likelihood function

hermiteInterpolation(x, profile)

Arguments

x

The log(hazard ratio) for which to approximate the log likelihood.

profile

A profile as created with approximateLikelihood() with approximation = "grid with gradients". This is a data frame with 3 columns: point, value, and derivative, sorted by point.

Value

The approximate log likelihood for the given x.

Details

Performs spline interpolation using cubic Hermite polynomials (Catmull et al. 1974) between the points specified in the profile. We use linear extrapolation outside the points.

References

Catmull, Edwin; Rom, Raphael (1974), "A class of local interpolating splines", in Barnhill, R. E.; Riesenfeld, R. F. (eds.), Computer Aided Geometric Design, New York: Academic Press, pp. 317–326

Examples

profile <- data.frame(point = c(1.1, 2.1), value = c(1, 1), derivative = c(0.1, -0.1))
hermiteInterpolation(x = 0:3, profile = profile)
#> [1] 0.890 0.990 1.009 0.910