Skip to content

Releases: causalfragility-lab/MultiSpline

MultiSpline 0.2.0

Choose a tag to compare

@causalfragility-lab causalfragility-lab released this 16 Apr 12:01

MultiSpline 0.2.0

Now on CRANinstall.packages("MultiSpline")

This is a major update adding a complete estimation, interpretation, and
diagnostic framework for nonlinear multilevel spline modeling in R.
All v0.1.0 function calls remain valid without modification.


What's new

Cross-classified and nested multilevel structures

Supply two cluster variables and choose cross-classified or nested
random effects:

# Cross-classified
nl_fit(data = df, y = "score", x = "age",
       cluster = c("school_id", "student_id"), nested = FALSE)

# Nested  (higher-level grouping first)
nl_fit(data = df, y = "score", x = "age",
       cluster = c("school_id", "student_id"), nested = TRUE)

Automatic knot / df selection

# Standalone diagnostic
nl_knots(data = df, y = "score", x = "age", df_range = 2:8)

# Or inside nl_fit
nl_fit(data = df, y = "score", x = "age", df = "auto")

Multilevel R-squared decomposition

nl_r2(fit)
# Returns marginal R2m, conditional R2c, and a full variance
# partition table (r2_mlm style) across all random-effect levels

Derivative-based interpretation

deriv <- nl_derivatives(pred, x = "age")   # d1, d2 with CI bands
tp    <- nl_turning_points(deriv, x = "age") # maxima, minima, inflections

nl_plot(deriv_df = deriv, x = "age", type = "slope")
nl_plot(deriv_df = deriv, x = "age", type = "curvature")
nl_plot(pred_df = pred, deriv_df = deriv, x = "age", type = "combo")

Model comparison workflow

nl_compare(fit, polynomial_degrees = 2:3)
# AIC, BIC, log-likelihood, LRT vs linear for all candidate models

Cluster heterogeneity analysis

nl_het(fit, n_clusters_plot = 30)
# Plots subject BLUPs vs population mean
# LRT: random slopes vs random intercepts

Additional features

  • B-spline basis: method = "bs", bs_degree argument
  • Random spline slopes: random_slope = TRUE
  • CI for glmerMod via delta method (default) or bootstrap
    (glmer_ci = "boot")

Bug fixes

  • nl_r2() variance partition no longer produces NA rows in nested models
  • nl_predict() CI now correct when controls are character variables
  • nl_plot() no longer errors when no time column is present

Installation

# From CRAN (recommended)
install.packages("MultiSpline")

# Development version from GitHub
remotes::install_github("causalfragility-lab/MultiSpline")

Citation

citation("MultiSpline")

Hait, S. (2026). MultiSpline: Spline-Based Nonlinear Modeling for
Multilevel and Longitudinal Data
. R package version 0.2.0.
https://CRAN.R-project.org/package=MultiSpline


Full changelog

See [NEWS.md](https://github.com/causalfragility-lab/MultiSpline/blob/main/NEWS.md)

MultiSpline v0.1.1

Choose a tag to compare

@causalfragility-lab causalfragility-lab released this 27 Feb 15:21
af3474c

MultiSpline v0.1.1

  • Added references to DESCRIPTION
  • Replaced dontrun with donttest in examples
  • Updated README with version and citation
  • Updated JOSS paper and bibliography

MultiSpline v0.1.0 - Initial Release

Choose a tag to compare

@causalfragility-lab causalfragility-lab released this 27 Feb 15:03

Initial CRAN submission of MultiSpline v0.1.0

  • nl_fit() for nonlinear multilevel modeling
  • nl_summary() for coefficient output
  • nl_predict() for predictions
  • nl_plot() for visualization
  • nl_icc() for intraclass correlations