find_scale_factor: Function that calculates an integer used to scale predictor

View source: R/preprocessing.R

find_scale_factorR Documentation

Function that calculates an integer used to scale predictor

Description

Function that calculates an integer used to scale predictor

Usage

find_scale_factor(x)

Arguments

x

a numeric vector already shifted to positive values (see find_shift_factor()). This function requires at least 2 distinct values to work.

#' @examples x = 1:1000 find_scale_factor(x)

Details

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

The determination of the scaling factor is independent (i.e. not affected by) shifts in the input data, as it only depends on the range of the input data.

Note that the estimation of powers is unaffected by scaling, the same powers are found for scaled input data. In extreme cases scaling is necessary to preserve accuracy, see Royston and Sauerbrei (2008). This formula uses the scaling formula from Section 4.11.1 of Royston and Sauerbrei (2008). Further information can also be found in the Stata manual for mfp at https://www.stata.com/manuals/rfp.pdf.

Value

An integer that can be used to scale x to a reasonable range. For binary variables 1 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.


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