mfp21.0.1 package

Multivariable Fractional Polynomial Models with Extensions

apply_acd

Function to apply Approximate Cumulative Distribution (ACD)

apply_shift_scale

Shift and scale vector x

assign_df

Helper to assign degrees of freedom

backscale_matrix

Backscale Columns of a Matrix (Internal)

calculate_df

Helper to calculates the final degrees of freedom for the selected mod...

calculate_f_test

Function to compute F-statistic and p-value from deviances

calculate_lr_test

Function to calculate p-values for likelihood-ratio test

calculate_model_metrics

Function to compute model metrics to be used within mfp2

calculate_number_fp_powers

Calculates the total number of fractional polynomial powers in adjustm...

calculate_standard_error

Helper function to compute standard error of a partial predictor

center_matrix

Simple function to center data

coef.mfp2

Extract coefficients from object of class mfp2

convert_powers_list_to_matrix

Helper to convert a nested list with same or different length into a m...

create_dummy_variables

Simple function to create dummy variables for ordinal and nominal vari...

create_fp_terms

Helper to create overview table of fp terms

deviance_gaussian

Deviance computations as used in mfp in stata

ensure_length

Helper function to ensure vectors have a specified length

find_best_fp_cycle

Helper to run cycles of the mfp algorithm

find_best_fp_step

Function to estimate the best FP functions for a single variable

find_best_fp1_for_acd

Function to fit univariable FP1 models for acd transformation

find_best_fpm_step

Function to find the best FP functions of given degree for a single va...

find_scale_factor

Function that calculates an integer used to scale predictor

find_shift_factor

Function that calculates a value used to shift predictor

fit_acd

Function to estimate approximate cumulative distribution (ACD)

fit_cox

Function that fits Cox proportional hazards models

fit_glm

Function that fits generalized linear models

fit_linear_step

Function to fit linear model for variable of interest

fit_mfp

Function for fitting a model using the MFP or MFPA algorithm

fit_model

Function that fits models supported by mfp2

fit_null_step

Function to fit null model excluding variable of interest

fp

Helper to assign attributes to a variable undergoing FP-transformation

fracplot

Plot response functions from a fitted mfp2 object

generate_combinations_with_replacement

Helper function to generate combinations with replacement

generate_powers_fp

Function that generates a matrix of FP powers for any degree

generate_transformations_fp

Function to generate all requested FP transformations for a single var...

get_selected_variable_names

Helper function to extract selected variables from fitted mfp2 objec...

mfp2

Multivariable Fractional Polynomial Models with Extensions

name_transformed_variables

Helper function to name transformed variables

order_variables

Helper to order variables for mfp2 algorithm

predict.mfp2

Predict Method for mfp2

prepare_newdata_for_predict

Helper function to prepare newdata for predict function

print_mfp_step

Function for verbose printing of function selection procedure (FSP)

print.mfp2

Print method for objects of class mfp2

reset_acd

Helper to reset acd transformation for variables with few values

select_ic

Function selection procedure based on information criteria

select_linear

Helper to select between null and linear term for a single variable

select_ra2_acd

Function selection procedure for ACD based on closed testing procedure

select_ra2

Function selection procedure based on closed testing procedure

summary.mfp2

Summarizing mfp2 model fits

transform_data_step

Function to extract and transform adjustment variables

transform_matrix

Function to transform each column of matrix using final FP powers or a...

transform_vector_fp

Functions to transform a variable using fractional polynomial powers o...

transform_vector_power

Simple function to transform vector by a single power

Multivariable fractional polynomial algorithm simultaneously selects variables and functional forms in both generalized linear models and Cox proportional hazard models. Key references are Royston and Altman (1994) <doi:10.2307/2986270> and Royston and Sauerbrei (2008, ISBN:978-0-470-02842-1). In addition, it can model a sigmoid relationship between variable x and an outcome variable y using the approximate cumulative distribution transformation proposed by Royston (2014) <doi:10.1177/1536867X1401400206>. This feature distinguishes it from a standard fractional polynomial function, which lacks the ability to achieve such modeling.

  • Maintainer: Edwin Kipruto
  • License: GPL-3
  • Last published: 2025-05-15