find_best_fp_cycle {mfp2}R Documentation

Helper to run cycles of the mfp algorithm

Description

This function estimates the best FP functions for all predictors in the current cycle. To be used in fit_mfp().

Usage

find_best_fp_cycle(
  x,
  y,
  powers_current,
  df,
  weights,
  offset,
  family,
  criterion,
  select,
  alpha,
  keep,
  powers,
  method,
  strata,
  verbose,
  ftest,
  control,
  rownames,
  nocenter,
  acdx
)

Arguments

x

an input matrix of dimensions nobs x nvars. Does not contain intercept, but columns are already expanded into dummy variables as necessary. Data are assumed to be shifted and scaled.

y

a vector for the response variable or a Surv object.

powers_current

a list of length equal to the number of variables, indicating the fp powers to be used in the current step for all variables (except xi).

df

a numeric vector of length nvars of degrees of freedom.

weights

a vector of observation weights of length nobs.

offset

a vector of length nobs of offsets.

family

a character string representing a family object.

criterion

a character string defining the criterion used to select variables and FP models of different degrees.

select

a numeric vector of length nvars indicating significance levels for backward elimination.

alpha

a numeric vector of length nvars indicating significance levels for tests between FP models of different degrees.

keep

a character vector with names of variables to be kept in the model.

powers

a named list of numeric values that sets the permitted FP powers for each covariate.

method

a character string specifying the method for tie handling in Cox regression model.

strata

a factor of all possible combinations of stratification variables. Returned from survival::strata().

verbose

a logical; run in verbose mode.

ftest

a logical indicating the use of the F-test for Gaussian models.

control

a list with parameters for model fit. See survival::coxph() or stats::glm() for details.

rownames

passed to survival::coxph.fit().

nocenter

a numeric vector with a list of values for fitting Cox models. See survival::coxph() for details.

acdx

a logical vector of length nvars indicating which continuous variables should undergo the approximate cumulative distribution (ACD) transformation.

Details

A cycle is defined as a complete pass through all the predictors in the input matrix x, while a step is defined as the assessment of a single predictor. This algorithm is described in Sauerbrei et al. (2006) and given in detail in Royston and Sauerbrei (2008), in particular chapter 6.

Briefly, a cycle works as follows: it takes as input the data matrix along with a set of current best fp powers for each variable. In each step, the fp powers of a single covariate are assessed, while adjusting for other covariates. Adjustment variables are transformed using their current fp powers (this is done in transform_data_step()) and the fp powers of the variable of interest are tested using the closed test procedure (conducted in find_best_fp_step()). Some of the adjustment variables may have their fp power set to NA, which means they were not selected from the working model and are not used in that step. The results from all steps are returned, completing a cycle.

Note that in each cycle every variable is evaluated.This includes variables that may have been eliminated in previous cycles. They will re-enter each new cycle for potential inclusion in the working model or to be re-evaluated for elimination.

The current adjustment set is always given through the current fp powers, which are updated in each step (denoted as powers_current).

Value

current FP powers

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.
Sauerbrei, W., Meier-Hirmer, C., Benner, A. and Royston, P., 2006. Multivariable regression model building by using fractional polynomials: Description of SAS, STATA and R programs. Comput Stat Data Anal, 50(12): 3464-85. Sauerbrei, W. and Royston, P., 1999. Building multivariable prognostic and diagnostic models: transformation of the predictors by using fractional polynomials. J Roy Stat Soc a Sta, 162:71-94.


[Package mfp2 version 1.0.0 Index]