pearl.interpolate
Module for interpolation calculations used in the PEARL model.
- pearl.interpolate.restricted_cubic_spline_var(x: numpy.typing.NDArray.typing.Any, knots: numpy.typing.NDArray.typing.Any, i: int) Any
Return a pandas Series of the i-th restricted cubic spline variable for numpy array x with knots. Adapted from: https:github.com/harrelfe/Hmisc/blob/master/R/rcspline.eval.s
- Parameters:
x (np.array) – Array to apply spline interpolation to.
knots (np.array) – Array containing the values of the knots.
i (int) – The knot for calculation.
- Returns:
The interpolated array.
- Return type:
np.array
- Raises:
ValueError – Raises an error if i is not 1 or 2 as this is undefined for cubic splines.
- pearl.interpolate.restricted_quadratic_spline_var(x: numpy.typing.NDArray.typing.Any, knots: numpy.typing.NDArray.typing.Any, i: int) Any
Return a pandas Series of the i-th restricted cubic spline variable for numpy array x with knots. Adapted from: https:github.com/harrelfe/Hmisc/blob/master/R/rcspline.eval.s
- Parameters:
x (np.array) – Array to apply spline interpolation to.
knots (np.array) – Array containing the values of the knots.
i (int) – The knot for calculation.
- Returns:
The interpolated array.
- Return type:
np.array
- Raises:
ValueError – Raises an error if i is not 1, 2, or 3 as this is undefined for quadratic splines.