semicontinuous_models
semicontinuous_models provides reusable model implementations for semi-continuous outcomes:
- Two-part model (logit + gamma log link)
- Tweedie GLM (quasi-likelihood)
- Log-normal regression with smearing retransformation
- Selection and comparison utilities (Park test, AIC/BIC, cross-validation)
The crate was originally developed for a healthcare outcome study, but the API is domain-agnostic and can be reused for any non-negative semi-continuous response.
Installation
[]
= "0.1"
Quick start
use ;
use Mat;
let n = 40;
let design_matrix = from_fn;
let outcome = from_fn;
let input = new;
let = fit_two_part_input.expect;
let prediction = model.predict;
assert_eq!;
assert!;
Public entry points
fit_two_part_inputfit_two_part_weighted_inputfit_two_part_clustered_inputfit_tweedie_inputfit_lognormal_smearing_inputselect_models_inputcross_validate_models_inputcompare_models_input
Data contract
- Provide an intercept column explicitly if you want one.
- Outcomes are expected to be non-negative and shaped as
n x 1. - Weights (if provided) must be strictly positive and shaped as
n x 1. - Cluster labels (if provided) must have length
n.
Examples
From crate root: