find_shift_factor: Function that calculates a value used to shift predictor

View source: R/preprocessing.R

find_shift_factorR Documentation

Function that calculates a value used to shift predictor

Description

Function that calculates a value used to shift predictor

Usage

find_shift_factor(x)

Arguments

x

a numeric vector.

Details

For details on why shifting is necessary see the corresponding section in the documentation of mfp2().

This function implements the formula in Section 4.7 of Royston and Sauerbrei (2008).

Value

A numeric value that can be used to shift x to positive values. If all values are positive, or if x is binary then 0 is returned.

References

Royston, P., and Sauerbrei, W., 2008. Multivariable Model - Building: A Pragmatic Approach to Regression Anaylsis based on Fractional Polynomials for Modelling Continuous Variables. John Wiley & Sons.

Examples

x = 1:1000
find_shift_factor(x)


mfp2 documentation built on Nov. 15, 2023, 1:06 a.m.