Learn R Programming

mfp2 (version 1.0.0)

find_shift_factor: Function that calculates a value used to shift predictor

Description

Function that calculates a value used to shift predictor

Usage

find_shift_factor(x)

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.

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).

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

Run this code
x = 1:1000
find_shift_factor(x)

Run the code above in your browser using DataLab