transform_data_step: Function to extract and transform adjustment variables

View source: R/mfp_step.R

transform_data_stepR Documentation

Function to extract and transform adjustment variables

Description

Function to extract and transform adjustment variables

Usage

transform_data_step(x, xi, powers_current, df, powers, acdx)

Arguments

x

a matrix of predictors that includes the variable of interest xi. It is assumed that continuous variables have already been shifted and scaled.

xi

name of the continuous predictor for which the FP function will be estimated. There are no binary or two-level variables allowed. All variables except xi are referred to as "adjustment variables".

powers_current

a named list of FP powers of all variables of interest, including xi. Note that these powers are updated during backfitting or MFP cycles.

df

a numeric vector of degrees of freedom for xi.

powers

a set of allowed FP powers.

acdx

a logical vector indicating the use of acd transformation.

Details

After extracting the adjustment variables this function, using their corresponding FP powers stored in powers_current, transforms them. This is necessary When evaluating x of interest, as we must account for other variables, which can be transformed or untransformed, depending on the individual powers. It's worth noting that some powers can be NA, indicating that the variable has been left out of the adjustment variables. It also returns the FP data, which is dependent on the degrees of freedom. For example, df = 2 is equivalent to FP degree one, resulting in the generation of 8 variables. If acdx for the current variables of interest is set to TRUE, however, 64 variables are generated.

When df = 1, this function returns data unchanged, i.e. a "linear" transformation with power equal to 1. In case acdx[xi] = TRUE, the acd transformation is applied.

Value

A list containing the following elements:

  • powers_fp: fp powers used for data_fp.

  • data_fp: a list with all possible fp transformations for xi, see the data component of the output of generate_transformations_fp() and generate_transformations_acd().

  • powers_adj: fp powers for adjustment variables in data_adj.

  • data_adj: adjustment data, i.e. transformed input data for adjustment variables.


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