Get started

ferx fits nonlinear mixed-effects models defined in a small, readable DSL (.ferx files), powered by a Rust engine. There are two ways to run it:

Both call the same engine and produce the same estimates.


Run from R

Prerequisites

The R package compiles the Rust engine from source, so a stable Rust toolchain and cmake must be present before you install it. pak does not install them for you — without them the install fails at the compile step.

brew install cmake
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
source "$HOME/.cargo/env"
sudo apt install cmake            # Debian/Ubuntu; use your package manager
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
source "$HOME/.cargo/env"

Install Rtools45 (it bundles cmake) and rustup, then add the GNU-ABI toolchain in PowerShell:

rustup toolchain install stable-x86_64-pc-windows-gnu

The package build pins this toolchain automatically — no rustup default needed.

Verify the toolchain is visible before continuing:

rustc --version
cmake --version

The first install compiles the Rust backend: roughly 15-30 minutes on a fast machine, up to 1-2 hours on an older laptop. Later installs reuse Cargo’s cache and are much faster.

Platform gotchas — notably RStudio on macOS starting with a PATH that hides cargo — are covered in the installation chapter of the ferx-r book.

Install

pak::pak("FeRx-NLME/ferx-r")

Then fit the bundled warfarin example:

library(ferx)
ex  <- ferx_example("warfarin")
fit <- ferx_fit(ex$model, ex$data)
print(fit)

ferx_example() (no argument) lists all bundled examples.

For installation options (Docker, platform notes) and the full R workflow — diagnostics, simulation, covariates, IOV — see the ferx-r book.


Run from the CLI

The CLI ships with ferx-core. Building it from source needs the same stable Rust toolchain as above (cargo build --release). Point it at a .ferx model and a CSV:

ferx warfarin.ferx --data warfarin.csv

It writes the fit results (estimates, predictions) to disk next to the inputs.

For building the CLI, estimation settings, the .ferx DSL spec, and using the engine as a Rust library, see the ferx-core book.