This function estimates the best FP functions for all predictors in the
current cycle. To be used in fit_mfp()
.
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
)
current FP powers
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.
a vector for the response variable or a Surv
object.
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
).
a numeric vector of length nvars of degrees of freedom.
a vector of observation weights of length nobs.
a vector of length nobs of offsets.
a character string representing a family object.
a character string defining the criterion used to select variables and FP models of different degrees.
a numeric vector of length nvars indicating significance levels for backward elimination.
a numeric vector of length nvars indicating significance levels for tests between FP models of different degrees.
a character vector with names of variables to be kept in the model.
a named list of numeric values that sets the permitted FP powers for each covariate.
a character string specifying the method for tie handling in Cox regression model.
a factor of all possible combinations of stratification
variables. Returned from survival::strata()
.
a logical; run in verbose mode.
a logical indicating the use of the F-test for Gaussian models.
a list with parameters for model fit. See survival::coxph()
or stats::glm()
for details.
passed to survival::coxph.fit()
.
a numeric vector with a list of values for fitting Cox
models. See survival::coxph()
for details.
a logical vector of length nvars indicating which continuous variables should undergo the approximate cumulative distribution (ACD) transformation.
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
).
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.