apply_shift_scale {mfp2}R Documentation

Shift and scale vector x

Description

A function that is used to shift x values to positive values if it contains negative or zero values.If all values of x are positive then the original values of x is returned without shifting but scaled if the scaling factor is not equal to 1. If x has already been shifted and scaled then the function does nothing.

Usage

apply_shift_scale(x, scale = NULL, shift = NULL)

Arguments

x

A vector of predictor variable

scale

scaling factors for x of interest. Must be positive integers. Default is NULL and scaling factors are automatically estimated using find_scale_factor() function else it uses user supplied scaling factors. If no scaling is needed just use scale = 1

shift

adjustment factors required for shifting x to positive values. Default is NULL and adjustment factors are estimated automatically using find_shift_factor() function

Value

A numeric value that has been shifted and scaled.

Examples

x = 1:1000
apply_shift_scale(x)


[Package mfp2 version 1.0.0 Index]