select_ra2 {mfp2} | R Documentation |
Function selection procedure based on closed testing procedure
Description
Used in find_best_fp_step()
when criterion = "pvalue"
.
For parameter explanations, see find_best_fp_step()
. All parameters
captured by ...
are passed on to fit_model()
.
Usage
select_ra2(
x,
xi,
keep,
degree,
acdx,
y,
powers_current,
powers,
criterion,
ftest,
select,
alpha,
...
)
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. |
xi |
a character string indicating the name of the current variable of interest, for which the best fractional polynomial transformation is to be estimated in the current step. |
keep |
a character vector with names of variables to be kept in the model. |
degree |
integer > 0 giving the degree for the FP transformation. |
acdx |
a logical vector of length nvars indicating continuous variables to undergo the approximate cumulative distribution (ACD) transformation. |
y |
a vector for the response variable or a |
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 |
powers |
a named list of numeric values that sets the permitted FP powers for each covariate. |
criterion |
a character string defining the criterion used to select variables and FP models of different degrees. |
ftest |
a logical indicating the use of the F-test for Gaussian models. |
select |
a numeric value indicating the significance level
for backward elimination of |
alpha |
a numeric value indicating the significance level
for tests between FP models of different degrees for |
... |
passed to fitting functions. |
Details
In case criterion = "pvalue"
the function selection procedure as outlined
in Chapters 4 and 6 of Royston and Sauerbrei (2008) is used.
-
Step 1: test the best FPm function against a null model at level
select
with 2m df. If not significant, the variable is excluded. Otherwise continue with step 2. -
Step 2: test the best FPm versus a linear model at level
alpha
with 2m - 1 df. If not significant, use a linear model. Otherwise continue with step 3. -
Step 3: test the best FPm versus the best FP1 at level
alpha
with 2m - 2 df. If not significant, use the best FP1 model. Otherwise, repeat this step for all remaining higher order FPs until FPm-1, which is tested at levelalpha
with 2 df against FPm. If the final test is not significant, use a FPm-1 model, otherwise use FPm.
Note that the "best" FPx model used in each step is given by the model using
a FPx transformation for the variable of interest and having the highest
likelihood of all such models given the current powers for all other
variables, as outlined in Section 4.8 of Royston and Sauerbrei (2008).
These best FPx models are computed in find_best_fpm_step()
.
When a variable is forced into the model by including it in keep
, then
this function will not exclude it from the model (by setting its power to
NA
), but will only choose its functional form.
Value
A list with several components:
-
keep
: logical indicating ifxi
is forced into model. -
acd
: logical indicating if an ACD transformation was applied forxi
, i.e.FALSE
in this case. -
powers
: (best) fp powers investigated in step, indexingmetrics
. Always starts with highest power, then null, then linear, then FP in increasing degree (e.g. FP2, null, linear, FP1). -
power_best
: a numeric vector with the best power found. The returned best power may beNA
, indicating the variable has been removed from the model. -
metrics
: a matrix with performance indices for all models investigated. Same number of rows as, and indexed by,powers
. -
model_best
: row index of best model inmetrics
. -
pvalue
: p-value for comparison of linear and null model. -
statistic
: test statistic used, depends onftest
.
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.