Package: mfp2 1.0.2

Edwin Kipruto

mfp2: Multivariable Fractional Polynomial Models with Extensions

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.

Authors:Edwin Kipruto [aut, cre], Michael Kammer [aut], Patrick Royston [aut], Willi Sauerbrei [aut]

mfp2_1.0.2.tar.gz
mfp2_1.0.2.zip(r-4.5)mfp2_1.0.2.zip(r-4.4)mfp2_1.0.2.zip(r-4.3)
mfp2_1.0.2.tgz(r-4.4-any)mfp2_1.0.2.tgz(r-4.3-any)
mfp2_1.0.2.tar.gz(r-4.5-noble)mfp2_1.0.2.tar.gz(r-4.4-noble)
mfp2_1.0.2.tgz(r-4.4-emscripten)mfp2_1.0.2.tgz(r-4.3-emscripten)
mfp2.pdf |mfp2.html
mfp2/json (API)
NEWS

# Install 'mfp2' in R:
install.packages('mfp2', repos = c('https://edwinkipruto.r-universe.dev', 'https://cloud.r-project.org'))

Peer review:

Bug tracker:https://github.com/edwinkipruto/mfp2/issues

Datasets:
  • art - Artificial dataset with continuous response
  • gbsg - Breast cancer dataset used in the Royston and Sauerbrei (2008) book.
  • pima - Pima Indians dataset used in the Royston and Sauerbrei (2008) book.
  • prostate - Prostate cancer dataset used in the Royston and Sauerbrei (2008) book.

On CRAN:

17 exports 3 stars 1.86 score 29 dependencies 1 dependents 4 scripts 176 downloads

Last updated 4 months agofrom:1da9acbcda. Checks:OK: 7. Indexed: yes.

TargetResultDate
Doc / VignettesOKSep 18 2024
R-4.5-winOKSep 18 2024
R-4.5-linuxOKSep 18 2024
R-4.4-winOKSep 18 2024
R-4.4-macOKSep 18 2024
R-4.3-winOKSep 18 2024
R-4.3-macOKSep 18 2024

Exports:apply_shift_scaleassign_dfcenter_matrixcreate_dummy_variablesfind_scale_factorfind_shift_factorfit_acdfpfp2fracplotgenerate_powers_acdgenerate_powers_fpget_selected_variable_namesmfp2transform_matrixtransform_vector_acdtransform_vector_fp

Dependencies:clicolorspacefansifarverggplot2gluegtableisobandlabelinglatticelifecyclemagrittrMASSMatrixmgcvmunsellnlmepillarpkgconfigR6RColorBrewerrlangscalessurvivaltibbleutf8vctrsviridisLitewithr

Multivariable Fractional Polynomials with Extensions

Rendered frommfp2.Rmdusingknitr::rmarkdownon Sep 18 2024.

Last update: 2023-11-13
Started: 2023-06-16

Readme and manuals

Help Manual

Help pageTopics
Function to apply Approximate Cumulative Distribution (ACD)apply_acd
Shift and scale vector xapply_shift_scale
Artificial dataset with continuous responseart
Helper to assign degrees of freedomassign_df
Helper to calculates the final degrees of freedom for the selected modelcalculate_df
Function to compute F-statistic and p-value from deviancescalculate_f_test
Function to calculate p-values for likelihood-ratio testcalculate_lr_test
Function to compute model metrics to be used within 'mfp2'calculate_model_metrics
Calculates the total number of fractional polynomial powers in adjustment variables.calculate_number_fp_powers
Helper function to compute standard error of a partial predictorcalculate_standard_error
Simple function to center datacenter_matrix
Extract coefficients from object of class 'mfp2'coef.mfp2
Helper to convert a nested list with same or different length into a matrixconvert_powers_list_to_matrix
Simple function to create dummy variables for ordinal and nominal variablescreate_dummy_variables
Helper to create overview table of fp termscreate_fp_terms
Deviance computations as used in mfp in statadeviance_gaussian
Helper function to ensure vectors have a specified lengthensure_length
Helper to run cycles of the mfp algorithmfind_best_fp_cycle
Function to estimate the best FP functions for a single variablefind_best_fp_step
Function to fit univariable FP1 models for acd transformationfind_best_fp1_for_acd
Function to find the best FP functions of given degree for a single variablefind_best_fpm_step
Function that calculates an integer used to scale predictorfind_scale_factor
Function that calculates a value used to shift predictorfind_shift_factor
Function to estimate approximate cumulative distribution (ACD)fit_acd
Function that fits Cox proportional hazards modelsfit_cox
Function that fits generalized linear modelsfit_glm
Function to fit linear model for variable of interestfit_linear_step
Function for fitting a model using the MFP or MFPA algorithmfit_mfp
Function that fits models supported by 'mfp2'fit_model
Function to fit null model excluding variable of interestfit_null_step
Helper to assign attributes to a variable undergoing FP-transformationfp fp2
Plot response functions from a fitted 'mfp2' objectfracplot plot_mfp
Breast cancer dataset used in the Royston and Sauerbrei (2008) book.gbsg
Helper function to generate combinations with replacementgenerate_combinations_with_replacement
Function that generates a matrix of FP powers for any degreegenerate_powers_acd generate_powers_fp
Function to generate all requested FP transformations for a single variablegenerate_transformations_acd generate_transformations_fp
Helper function to extract selected variables from fitted 'mfp2' objectget_selected_variable_names
Multivariable Fractional Polynomial Models with Extensionsmfp2 mfp2.default mfp2.formula
Helper function to name transformed variablesname_transformed_variables
Helper to order variables for mfp2 algorithmorder_variables order_variables_by_significance
Pima Indians dataset used in the Royston and Sauerbrei (2008) book.pima
Predict Method for 'mfp2' Fitspredict.mfp2
Helper function to prepare newdata for predict functionprepare_newdata_for_predict
Function for verbose printing of function selection procedure (FSP)print_mfp_ic_step print_mfp_pvalue_step print_mfp_step
Print method for objects of class 'mfp2'print.mfp2
Prostate cancer dataset used in the Royston and Sauerbrei (2008) book.prostate
Helper to reset acd transformation for variables with few valuesreset_acd
Function selection procedure based on information criteriaselect_ic select_ic_acd
Helper to select between null and linear term for a single variableselect_linear
Function selection procedure based on closed testing procedureselect_ra2
Function selection procedure for ACD based on closed testing procedureselect_ra2_acd
Summarizing 'mfp2' model fitssummary.mfp2
Function to extract and transform adjustment variablestransform_data_step
Function to transform each column of matrix using final FP powers or acdtransform_matrix
Functions to transform a variable using fractional polynomial powers or acdtransform_vector_acd transform_vector_fp
Simple function to transform vector by a single powertransform_vector_power