Skip to main content

Continuous effects

Adjust a polynomial to smooth out your coefficients

Diego Sanchez avatar
Written by Diego Sanchez
Updated over 2 months ago

"Continuous effects" is a feature in RATE that allows the user to modify Risk model blocks, by making the effect of one or more variables continuous. This replaces the effect of the coefficients. It is an automatic best approximation of the coefficients. The user controls the shape of the continuous curve.

What kind of variables support continuous effects?

  • Continuous effect is supported on variables coming from DATA or blocks being used as variables that are both numeric and ordinal.

  • The levels in the model must be numeric as well.

  • The variable must not have missing levels.

  • In terms of levels management, the variable must either have a binned representation, and the Interval Labels must be “Centroids” or the variable must have an exact representation that is not modified by the user.
    Remember that these characteristics can be explored in the Level Management screen.

Where can I apply continuous effects?

You need to select the model and, from the side bar, go to Edit Block -> Edit variable matching. In the edit matching dialog, select the variable where you would like to apply the polynomial fit, click “Edit coefficients”, and look for the Continuous effect controls on the bottom right:

Note that the Continuous Effects option will not be available if your variable does not satisfy the conditions listed above.

The mathematics behind the continuous effects

A continuous effect is a B-spline with linear extrapolation in the linear prediction space of the GLM:

  • It is a piece-wise polynomial function of 1 variable, defined on the entire real line.

  • The polynomial components can have degree 1, 2 or 3.

  • The derivative of the B-spline can have some discontinuities, at x-values called knots, but is otherwise continuous. This means:

    • A degree 1 B-spline is piece-wise linear function, and changes direction at knots.

    • A degree 2 B-spline is a piece-wise quadratic function. It is once differentiable and changes 2nd derivative at knots.

  • The first and last knot are special: the first derivative of the spline has no discontinuity there. The spline is extrapolated linearly according to the first derivative at the first and last knot.

We find the best possible polynomial of this kind using a least-squares fit on the underlying data without considering the exposure.

You can read more about B-splines here.

How can I compute a model after I apply the continuous effects?

If you apply your continuous effects on Akur8, you can just click on Compute. Akur8 will know use the continuous effect instead of the coefficients over the underlying data.

If you would like to replicate the computation outside Akur8, you can also do so. First, export the block in the JSON format. Then, you can use the following Python code to evaluate the spline in the linear space at a point x:

import scipy
spline = scipy.interpolate.BSpline(t=knots, c=coefficients, k=degree) spline(x)

If x falls outside the interval between the first and last knot, the extrapolation method of Scipy is different from the extrapolation method in Akur8. To reproduce the result from Akur8, calculate the values of the derivative at the first and last knot, to perform the linear extrapolation manually: spline(knots[0], 1) and spline(knots[-1], 1).

Did this answer your question?