Let’s say we’ve knowledge

such that

. (We assume no ties among the many

‘s for simplicity.) * Isotonic regression* provides us a monotonic match

for the

‘s by fixing the issue

(See this earlier put up for extra particulars.) * Almost-isotonic regression*, launched by Tibshirani et al. (2009) (Reference 1), generalizes isotonic regression by fixing the issue

the place

and

is a user-specified hyperparameter.

It seems that, attributable to properties of the optimization downside, the nearly-isotonic regression match could be computed for **all**

values in

time, making it a sensible methodology to be used. See Part three and Algorithm 1 of Reference 1 for particulars. (Extra precisely, we will decide the nearly-isotonic regression match for a crucial set of

values: the match for another different

worth might be a linear interpolation of suits from this crucial set.)

* How is nearly-isotonic regression a generalization of isotonic regression?* The time period

is constructive if and provided that

) to the isotonic regression match (when

). (Truly, you’re going to get the isotonic regression match as soon as

is large enough such that any change within the penalty can’t be mitigated by the goodness of match enchancment.)

* Why may you need to use nearly-isotonic regression?* One doable cause is to verify if the belief monotonicity is cheap on your knowledge. To take action, run nearly-isotonic regression with cross-validation on

and compute the CV error for every

worth. If the CV error achieved by the isotonic regression match (i.e. largest

worth) is near or statistically indistinguishable from the minimal, that provides assurance that monotonicity is an inexpensive assumption on your knowledge.

You possibly can carry out nearly-isotonic regression in R with the `neariso`

bundle. The `neariso()`

perform returns suits for a complete path of

values. The animation under reveals how the match adjustments as

will get bigger and bigger (code out there right here).

* Observe 1:* The formulation for nearly-isotonic regression above assumes that the factors

are equally spaced. If they aren’t, one ought to change the penalty with

to account for the different-sized gaps. The `neariso`

bundle solely appears to deal with the case the place the

‘s are equally spaced.

* Observe 2:* The animation above was created by producing separate .png information for every worth of

, then stitching them collectively utilizing the `magick`

bundle. My preliminary hope was to create an animation that will transition easily between the totally different suits utilizing the `gganimate`

bundle however the transitions weren’t as easy as I’d have imagined them to be:

Does anybody understand how this problem might be fastened? Code for the animation is under, full code out there right here.

p <- ggplot(df, aes(x = x, y = beta)) + geom_path(col = "blue") + geom_point(knowledge = truth_df, aes(x = x, y = y), form = 4) + labs(title = "Almost isotonic regression suits", subtitle = paste("Lambda = ", "{lambda[as.integer(closest_state)]}")) + transition_states(iter, transition_length = 1, state_length = 2) + theme_bw() + theme(plot.title = element_text(dimension = rel(1.5), face = "daring")) animate(p, fps = 5)

References:

- Tibshirani, R. J., Hoefling, H., and Tibshirani, R. (2011). Almost-isotonic regression.