Stats Regression generalizedlinearmodel - CyrilB1531/lodestar GitHub Wiki

HomeStats-RegressionGeneralized linear models

GeneralizedLinearModel

A generalized linear model, fitted by IRLS, with the whole inference table.

public static class GeneralizedLinearModel

Example — a logistic fit, and the table that makes it inference.

using Lodestar.Stats.Regression;

double[] design = [0.0, 1.0, 2.0, 3.0, 4.0, 5.0];
double[] response = [0.0, 0.0, 1.0, 0.0, 1.0, 1.0];

GlmSummary fit = GeneralizedLinearModel.Fit(design, response, 1, GlmFamily.Binomial);

double slope = fit.Coefficients[1];   // => 1.2140275858506062
double deviance = fit.Deviance;       // => 4.955973670099227
bool converged = fit.Converged;       // => True

Remarks — reference behavior is statsmodels 0.15.0's GLM(...).fit(). The response is a count or a {0, 1} outcome; for a real-valued one, OrdinaryLeastSquares is the same table without a link.

Applies to — net10.0, netstandard2.0.

See alsoGlmSummary, GlmOptions, GlmFamily, the generalized linear model index.

Members

Member What it does
GeneralizedLinearModel.Fit Fits one model and reports its inference table.