Package: mfp2 1.1.1

Edwin Kipruto

mfp2: Multivariable Fractional Polynomial Models with Extensions

Fits multivariable fractional polynomial models with selection of predictors and functional forms. The mfp2() function supports generalized linear models, including Gamma and inverse-Gaussian regression; negative-binomial, multinomial and ordinal regression; generalized estimating equations for clustered data; Cox and parametric survival models; and Fine-Gray competing-risks models. Extensions include approximate cumulative distribution transformations for sigmoid-shaped associations and spike-at-zero modelling for semi-continuous covariates. The mfpi() function assesses interactions between a categorical grouping variable and continuous, binary, or categorical predictors. Fractional polynomial modelling is described by Royston and Altman (1994) <doi:10.2307/2986270> and Royston and Sauerbrei (2008, ISBN:978-0-470-02842-1). The approximate cumulative distribution extension follows Royston (2014) <doi:10.1177/1536867X1401400206> and Royston and Sauerbrei (2016) <doi:10.1177/1536867X1601600109>. Spike-at-zero modelling follows Becher et al. (2012) <doi:10.1002/bimj.201100263>. Interaction analyses follow Royston and Sauerbrei (2004) <doi:10.1002/sim.1815>, Royston and Sauerbrei (2013) <doi:10.1002/sim.5813>, and Royston and Sauerbrei (2014) <doi:10.1002/sim.6308>.

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

mfp2_1.1.1.tar.gz
mfp2_1.1.1.zip(r-4.7-x86_64)mfp2_1.1.1.zip(r-4.7-arm64)mfp2_1.1.1.zip(r-4.6-x86_64)mfp2_1.1.1.zip(r-4.6-arm64)mfp2_1.1.1.zip(r-4.5-x86_64)
mfp2_1.1.1.tgz(r-4.6-x86_64)mfp2_1.1.1.tgz(r-4.6-arm64)mfp2_1.1.1.tgz(r-4.5-x86_64)mfp2_1.1.1.tgz(r-4.5-arm64)
mfp2_1.1.1.tar.gz(r-4.7-arm64)mfp2_1.1.1.tar.gz(r-4.7-x86_64)mfp2_1.1.1.tar.gz(r-4.6-arm64)mfp2_1.1.1.tar.gz(r-4.6-x86_64)
mfp2_1.1.1.tgz(r-4.6-emscripten)
manual.pdf |manual.html✨
DESCRIPTION |NEWS
card.svg |card.png
mfp2/json (API)

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

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

Uses libs:
  • c++– GNU Standard C++ Library v3
Datasets:
  • advanced_prostate_cancer - Advanced prostate cancer dataset used in Royston and Sauerbrei (2008) book.
  • art - Artificial dataset with continuous response
  • gbsg - Breast cancer dataset used in Royston and Sauerbrei (2008) book.
  • pima - Pima Indians dataset used in Royston and Sauerbrei (2008) book.
  • prostate - Prostate cancer dataset used in Royston and Sauerbrei (2008) book.

On CRAN:

Conda:

cpp

7.52 score 2 stars 3 packages 52 scripts 564 downloads 13 exports 5 dependencies

Last updated from:87a6924b4b. Checks:15 OK. Indexed: yes.

TargetResultTimeFilesSyslog
linux-devel-arm64OK219
linux-devel-x86_64OK319
source / vignettesOK295
linux-release-arm64OK284
linux-release-x86_64OK229
macos-release-arm64OK177
macos-release-x86_64OK555
macos-oldrel-arm64OK214
macos-oldrel-x86_64OK646
windows-devel-arm64OK437
windows-devel-x86_64OK479
windows-release-arm64OK439
windows-release-x86_64OK396
windows-oldrel-x86_64OK374
wasm-releaseOK170

Exports:finegray_familyfpfp2fracplotgee_familyget_selected_variable_namesmfp2mfpimultinomial_familynegbin_familyordinal_familysurvreg_familytransform_vector_fp

Dependencies:latticeMatrixnnetRcppsurvival

mfp2 User Guide
Introduction to the mfp2 package | Supported model families | Choosing an interface | Estimation algorithm | Installation | Linear regression | Fitting MFP models using the formula interface | A short matrix-interface example | Shifting and scaling of covariates | Manually specifying shifts and scales | Centering and prediction on the original predictor scale | Subsetting and analysis populations | Factors and grouped terms after subsetting | Setting degrees of freedom for each variable | Tuning parameters for MFP | Nominal significance levels | Information criteria | Retaining predictors and forcing functional forms | Model comparison tests | Choosing FP powers using subject-matter knowledge | Specifying candidate powers | Candidate powers and selected powers | Explanation of output from the model-selection algorithm | Methods defined for mfp2 | Inspecting the selected model | Summarising the fitted effects | Extracting and interpreting coefficients | Making predictions | Graphical presentation of FP functions | Fitted functions and residuals | Contrasts relative to a reference value | Choosing where to evaluate the function | Handling categorical variables | Unordered factors | Ordered factors | Formula-interface example | Categorical predictors in the matrix interface | Logistic regression | Survival data | Fitting a Cox model | Using a monotonic function for positive lymph nodes | Stratified Cox model | Examples for additional outcome families | Multinomial regression | Ordinal regression | Generalized estimating equations | References

Last update: 2026-11-12
Started: 2026-11-12

ACD Transformations with mfp2
Overview | Definition of the ACD transformation | Inverse normal transformation of ranks | Power-linear approximation | Back-transformation to the interval (0, 1) | Interpretation | ACD in the fractional polynomial family | Function-selection procedure for ACD (FSPA) | P-value selection | Information criteria | Simulation example | Fitting an ACD model | Matrix interface | Formula interface | Comparison with standard MFP | Plotting the fitted functions | Practical remarks | References

Last update: 2026-11-02
Started: 2026-11-02

MFP Methodology and Practical Considerations
MFP methodology and practical considerations | Overview of MFP | Fractional polynomial models for a continuous variable | Function selection procedure (FSP) | Multivariable MFP procedure | Backfitting cycles | Key issues and approaches to handling them | The variable has to be positive | Sample size and influential observations | Lack of fit | Local features | Model-selection uncertainty and limitations | References

Last update: 2026-11-02
Started: 2026-11-02

Modelling Spike-at-Zero Covariates with Fractional Polynomials
Introduction | Prostate cancer data | Univariable analysis with p-values | Forcing inclusion or the full SAZ model | Multivariable analysis | Selection with AIC or BIC | Simulated data: continuous + binary | Several SAZ covariates in one model | Matrix interface | Further details | Paper reference

Last update: 2026-11-02
Started: 2026-11-02

Multivariable Fractional Polynomial Interaction Models
Introduction | Advanced prostate cancer data | Interaction without adjustment | Plotting the interaction | Predictions at chosen ages | Interaction with adjustment for prognostic factors | Selection with AIC | Several interaction candidates | Fixed linear adjustment model | More than two groups | The xy interface | Further details | Paper reference

Last update: 2026-11-02
Started: 2026-11-02

Readme and manuals

Help Manual

Help pageTopics
mfp2: Multivariable Fractional Polynomial Models and Extensionsmfp2-package
Advanced prostate cancer dataset used in Royston and Sauerbrei (2008) book.advanced_prostate_cancer
Artificial dataset with continuous responseart
Extract Coefficients from an 'mfp2' Modelcoef.mfp2
Extract Coefficients from MFPI Interaction Modelscoef.mfpi
Confidence Intervals for 'mfp2' Model Parametersconfint.mfp2
Specify a Fractional-Polynomial Termfp fp2
Deprecated Fractional-Polynomial Plotting Interfacefracplot
Breast cancer dataset used in Royston and Sauerbrei (2008) book.gbsg
GEE Family Specificationgee_family
Extract Names of Selected Variables from an 'mfp2' Modelget_selected_variable_names
Multivariable Fractional Polynomial Models with Extensionsmfp2 mfp2.default mfp2.formula
Test Interactions with a Categorical Grouping Variablemfpi mfpi.default mfpi.formula
Multinomial Logistic Familymultinomial_family
Negative-Binomial Familynegbin_family
Ordinal Familyordinal_family
Pima Indians dataset used in Royston and Sauerbrei (2008) book.pima
Plot fitted term contributions and contrasts from an mfp2 modelplot.mfp2
Plot MFPI Fitted Functions and Group Differencesplot.mfpi
Predict from an 'mfp2' Modelpredict.mfp2
Predict from an MFPI Modelpredict.mfpi
Print a Fitted MFP Modelprint.mfp2
Print an '"mfpi"' Objectprint.mfpi
Print MFPI Coefficientsprint.mfpi_coef print.mfpi_coef_list
Print an MFPI Predictionprint.mfpi_prediction
Print a List of MFPI Predictionsprint.mfpi_prediction_list
Print a Collection of MFPI Variance-Covariance Matricesprint.mfpi_vcov_list
Print a Summary of an 'mfp2' Model Fitprint.summary.mfp2
Print a '"summary.mfpi"' Objectprint.summary.mfpi
Prostate cancer dataset used in Royston and Sauerbrei (2008) book.prostate
Extract Residuals from an 'mfp2' Modelresiduals.mfp2
Summarize an 'mfp2' Model Fitsummary.mfp2
Summarize an '"mfpi"' Objectsummary.mfpi
Survival Model Familiesfinegray_family survreg_family
Transform a Variable Using Fractional-Polynomial Powerstransform_vector_fp
Extract Variance-Covariance Matrices from MFPI Interaction Modelsvcov.mfpi