Writing your own estimator or solver¶
In the app: Help → Help contents, Writing your own estimator or solver.
NumPy, pandas and SciPy are ready in the Immediate and Code windows as np, pd and sp, and pymetrix.toolkit has the building blocks PyMetrix's own estimators use. toolkit.design(equation, data) turns a formula and a sample into arrays (y, X, names, rows used; lags, fixed effects and missing values handled); toolkit.least_squares, toolkit.covariance (classic, white, hac, Cluster), toolkit.sandwich, toolkit.hessian and toolkit.gradient do the inference; toolkit.result builds the fitted equation, with statistics and provenance. An estimator is a frozen dataclass of settings with an estimate(eq, data, ...) method; a solver has solve_period(system). Register either with toolkit.register("methods", ...) or ("solvers", ...) and it appears in the dialogs and works in scripts, projects, group loops and side-by-side tables like a built-in one. The repository's examples folder has a ridge-regression estimator and a damped Newton solver; pymetrix.testing.check_entry checks yours.