Products
  • Wolfram|One

    The definitive Wolfram Language and notebook experience

  • Mathematica

    The original technical computing environment

  • Wolfram Notebook Assistant + LLM Kit

    All-in-one AI assistance for your Wolfram experience

  • System Modeler
  • Wolfram Player
  • Finance Platform
  • Wolfram Engine
  • Enterprise Private Cloud
  • Application Server
  • Wolfram|Alpha Notebook Edition
  • Wolfram Cloud App
  • Wolfram Player App

More mobile apps

Core Technologies of Wolfram Products

  • Wolfram Language
  • Computable Data
  • Wolfram Notebooks
  • AI & Linguistic Understanding

Deployment Options

  • Wolfram Cloud
  • wolframscript
  • Wolfram Engine Community Edition
  • Wolfram LLM API
  • WSTPServer
  • Wolfram|Alpha APIs

From the Community

  • Function Repository
  • Community Paclet Repository
  • Example Repository
  • Neural Net Repository
  • Prompt Repository
  • Wolfram Demonstrations
  • Data Repository
  • Group & Organizational Licensing
  • All Products
Consulting & Solutions

We deliver solutions for the AI era—combining symbolic computation, data-driven insights and deep technical expertise

  • Data & Computational Intelligence
  • Model-Based Design
  • Algorithm Development
  • Wolfram|Alpha for Business
  • Blockchain Technology
  • Education Technology
  • Quantum Computation

WolframConsulting.com

Wolfram Solutions

  • Data Science
  • Artificial Intelligence
  • Biosciences
  • Healthcare Intelligence
  • Sustainable Energy
  • Control Systems
  • Enterprise Wolfram|Alpha
  • Blockchain Labs

More Wolfram Solutions

Wolfram Solutions For Education

  • Research Universities
  • Colleges & Teaching Universities
  • Junior & Community Colleges
  • High Schools
  • Educational Technology
  • Computer-Based Math

More Solutions for Education

  • Contact Us
Learning & Support

Get Started

  • Wolfram Language Introduction
  • Fast Intro for Programmers
  • Fast Intro for Math Students
  • Wolfram Language Documentation

More Learning

  • Highlighted Core Areas
  • Demonstrations
  • YouTube
  • Daily Study Groups
  • Wolfram Schools and Programs
  • Books

Grow Your Skills

  • Wolfram U

    Courses in computing, science, life and more

  • Community

    Learn, solve problems and share ideas.

  • Blog

    News, views and insights from Wolfram

  • Resources for

    Software Developers

Tech Support

  • Contact Us
  • Support FAQs
  • Support FAQs
  • Contact Us
Company
  • About Wolfram
  • Career Center
  • All Sites & Resources
  • Connect & Follow
  • Contact Us

Work with Us

  • Student Ambassador Initiative
  • Wolfram for Startups
  • Student Opportunities
  • Jobs Using Wolfram Language

Educational Programs for Adults

  • Summer School
  • Winter School

Educational Programs for Youth

  • Middle School Camp
  • High School Research Program
  • Computational Adventures

Read

  • Stephen Wolfram's Writings
  • Wolfram Blog
  • Wolfram Tech | Books
  • Wolfram Media
  • Complex Systems

Educational Resources

  • Wolfram MathWorld
  • Wolfram in STEM/STEAM
  • Wolfram Challenges
  • Wolfram Problem Generator

Wolfram Initiatives

  • Wolfram Science
  • Wolfram Foundation
  • History of Mathematics Project

Events

  • Stephen Wolfram Livestreams
  • Online & In-Person Events
  • Contact Us
  • Connect & Follow
Wolfram|Alpha
  • Your Account
  • User Portal
  • Wolfram Cloud
  • Products
    • Wolfram|One
    • Mathematica
    • Wolfram Notebook Assistant + LLM Kit
    • System Modeler
    • Wolfram Player
    • Finance Platform
    • Wolfram|Alpha Notebook Edition
    • Wolfram Engine
    • Enterprise Private Cloud
    • Application Server
    • Wolfram Cloud App
    • Wolfram Player App

    More mobile apps

    • Core Technologies
      • Wolfram Language
      • Computable Data
      • Wolfram Notebooks
      • AI & Linguistic Understanding
    • Deployment Options
      • Wolfram Cloud
      • wolframscript
      • Wolfram Engine Community Edition
      • Wolfram LLM API
      • WSTPServer
      • Wolfram|Alpha APIs
    • From the Community
      • Function Repository
      • Community Paclet Repository
      • Example Repository
      • Neural Net Repository
      • Prompt Repository
      • Wolfram Demonstrations
      • Data Repository
    • Group & Organizational Licensing
    • All Products
  • Consulting & Solutions

    We deliver solutions for the AI era—combining symbolic computation, data-driven insights and deep technical expertise

    WolframConsulting.com

    Wolfram Solutions

    • Data Science
    • Artificial Intelligence
    • Biosciences
    • Healthcare Intelligence
    • Sustainable Energy
    • Control Systems
    • Enterprise Wolfram|Alpha
    • Blockchain Labs

    More Wolfram Solutions

    Wolfram Solutions For Education

    • Research Universities
    • Colleges & Teaching Universities
    • Junior & Community Colleges
    • High Schools
    • Educational Technology
    • Computer-Based Math

    More Solutions for Education

    • Contact Us
  • Learning & Support

    Get Started

    • Wolfram Language Introduction
    • Fast Intro for Programmers
    • Fast Intro for Math Students
    • Wolfram Language Documentation

    Grow Your Skills

    • Wolfram U

      Courses in computing, science, life and more

    • Community

      Learn, solve problems and share ideas.

    • Blog

      News, views and insights from Wolfram

    • Resources for

      Software Developers
    • Tech Support
      • Contact Us
      • Support FAQs
    • More Learning
      • Highlighted Core Areas
      • Demonstrations
      • YouTube
      • Daily Study Groups
      • Wolfram Schools and Programs
      • Books
    • Support FAQs
    • Contact Us
  • Company
    • About Wolfram
    • Career Center
    • All Sites & Resources
    • Connect & Follow
    • Contact Us

    Work with Us

    • Student Ambassador Initiative
    • Wolfram for Startups
    • Student Opportunities
    • Jobs Using Wolfram Language

    Educational Programs for Adults

    • Summer School
    • Winter School

    Educational Programs for Youth

    • Middle School Camp
    • High School Research Program
    • Computational Adventures

    Read

    • Stephen Wolfram's Writings
    • Wolfram Blog
    • Wolfram Tech | Books
    • Wolfram Media
    • Complex Systems
    • Educational Resources
      • Wolfram MathWorld
      • Wolfram in STEM/STEAM
      • Wolfram Challenges
      • Wolfram Problem Generator
    • Wolfram Initiatives
      • Wolfram Science
      • Wolfram Foundation
      • History of Mathematics Project
    • Events
      • Stephen Wolfram Livestreams
      • Online & In-Person Events
    • Contact Us
    • Connect & Follow
  • Wolfram|Alpha
  • Wolfram Cloud
  • Your Account
  • User Portal
Wolfram Language & System Documentation Center
GeneralizedLinearModelFit
  • See Also
    • FittedModel
    • LogitModelFit
    • ProbitModelFit
    • LinearModelFit
    • NonlinearModelFit
    • TimeSeriesModelFit
    • Fit
    • LeastSquares
    • FindFit

    • Methods
    • LinearRegression
  • Related Guides
    • Statistical Model Analysis
    • Statistical Data Analysis
    • Scientific Data Analysis
    • Numerical Data
    • Matrix-Based Minimization
    • Tabular Modeling
    • Supervised Machine Learning
  • Tech Notes
    • Statistical Model Analysis
    • See Also
      • FittedModel
      • LogitModelFit
      • ProbitModelFit
      • LinearModelFit
      • NonlinearModelFit
      • TimeSeriesModelFit
      • Fit
      • LeastSquares
      • FindFit

      • Methods
      • LinearRegression
    • Related Guides
      • Statistical Model Analysis
      • Statistical Data Analysis
      • Scientific Data Analysis
      • Numerical Data
      • Matrix-Based Minimization
      • Tabular Modeling
      • Supervised Machine Learning
    • Tech Notes
      • Statistical Model Analysis

GeneralizedLinearModelFit[{{x1,y1},{x2,y2},…},{f1,f2,…},x]

constructs a generalized linear model of the form that fits the yi for each xi.

GeneralizedLinearModelFit[data,{f1,f2,…},{x1,x2,…}]

constructs a generalized linear model of the form where the fi depend on the variables xk.

GeneralizedLinearModelFit[{m,v}]

constructs a generalized linear model from the design matrix m and response vector v.

Details and Options
Details and Options Details and Options
Examples  
Basic Examples  
Scope  
Data  
Properties  
Data & Fitted Functions  
Residuals  
Dispersion and Deviances  
Parameter Estimation Diagnostics  
Influence Measures  
Prediction Values  
Goodness-of-Fit Measures  
Generalizations & Extensions  
Options  
ConfidenceLevel  
CovarianceEstimatorFunction  
DispersionEstimatorFunction  
Show More Show More
ExponentialFamily  
IncludeConstantBasis  
LinearOffsetFunction  
LinkFunction  
NominalVariables  
Weights  
WorkingPrecision  
Applications  
Properties & Relations  
See Also
Tech Notes
Related Guides
History
Cite this Page
BUILT-IN SYMBOL
  • See Also
    • FittedModel
    • LogitModelFit
    • ProbitModelFit
    • LinearModelFit
    • NonlinearModelFit
    • TimeSeriesModelFit
    • Fit
    • LeastSquares
    • FindFit

    • Methods
    • LinearRegression
  • Related Guides
    • Statistical Model Analysis
    • Statistical Data Analysis
    • Scientific Data Analysis
    • Numerical Data
    • Matrix-Based Minimization
    • Tabular Modeling
    • Supervised Machine Learning
  • Tech Notes
    • Statistical Model Analysis
    • See Also
      • FittedModel
      • LogitModelFit
      • ProbitModelFit
      • LinearModelFit
      • NonlinearModelFit
      • TimeSeriesModelFit
      • Fit
      • LeastSquares
      • FindFit

      • Methods
      • LinearRegression
    • Related Guides
      • Statistical Model Analysis
      • Statistical Data Analysis
      • Scientific Data Analysis
      • Numerical Data
      • Matrix-Based Minimization
      • Tabular Modeling
      • Supervised Machine Learning
    • Tech Notes
      • Statistical Model Analysis

GeneralizedLinearModelFit

GeneralizedLinearModelFit[{{x1,y1},{x2,y2},…},{f1,f2,…},x]

constructs a generalized linear model of the form that fits the yi for each xi.

GeneralizedLinearModelFit[data,{f1,f2,…},{x1,x2,…}]

constructs a generalized linear model of the form where the fi depend on the variables xk.

GeneralizedLinearModelFit[{m,v}]

constructs a generalized linear model from the design matrix m and response vector v.

Details and Options

  • GeneralizedLinearModelFit attempts to model the input data using a linear combination of functions transformed by a generic invertible function (link function).
  • GeneralizedLinearModelFit produces a generalized linear model of the form under the assumption that the original are independent observations following an exponential family distribution with mean and the function being an invertible link function.
  • The ExponentialFamily option controls the distribution while the LinkFunction option controls the form of .
  • GeneralizedLinearModelFit returns a symbolic FittedModel object to represent the generalized linear model it constructs. The properties and diagnostics of the model can be obtained from model["property"].
  • The value of the best-fit function from GeneralizedLinearModelFit at a particular point x1, … can be found from model[x1,…].
  • Data
  • Possible forms of data are:
  • {y1,y2,…}equivalent to the form {{1,y1},{2,y2},…}
    {{x11,x12,…,y1},…}a list of independent values xij and the responses yi
    {{x11,x12,…}y1,…}a list of rules between input values and response
    {{x11,x12,…},…}{y1,y2,…}a rule between a list of input values and responses
    {{x11,…,y1,…},…}nfit the n^(th) column of a matrix
    Tabular[…]namefit the column name in a tabular object
  • With multivariate data such as {{x_(11),x_(12),... ,y_(1)},{x_(21),x_(22),... ,y_(2)},...}, the number of coordinates xi1, xi2, … should equal the number of variables xi.
  • Additionally, data can be specified using a design matrix without specifying functions and variables:
  • {m,v}a design matrix m and response vector v
  • In GeneralizedLinearModelFit[m,v], the design matrix m is formed from the values of basis functions fi at data points in the form {{f1,f2,…},{f1,f2,…},…}. The response vector v is the list of responses {y1,y2,…}.
  • For a design matrix m and response vector v, the model is , where is the vector of parameters to be estimated.
  • When a design matrix is used, the basis functions fi can be specified using the form GeneralizedLinearModelFit[{m,v},{f1,f2,…}].
  • Options
  • GeneralizedLinearModelFit takes the following options:
  • AccuracyGoalAutomaticthe accuracy sought
    ConfidenceLevel 95/100confidence level for parameters and predictions
    CovarianceEstimatorFunction "ExpectedInformation"estimation method for the parameter covariance matrix
    DispersionEstimatorFunction Automaticfunction for estimating the dispersion parameter
    ExponentialFamily Automaticexponential family distribution for y
    IncludeConstantBasis Truewhether to include a constant basis function
    LinearOffsetFunction Noneknown offset in the linear predictor
    LinkFunction Automaticlink function for the model
    MaxIterationsAutomaticmaximum number of iterations to use
    NominalVariables Nonevariables considered as nominal
    PrecisionGoalAutomaticthe precision sought
    Weights Automaticweights for data elements
    WorkingPrecision Automaticthe precision for internal computations
  • With the setting IncludeConstantBasis->False, a model of the form is fitted.
  • With the setting LinearOffsetFunction->h, a model of the form is fitted.
  • With ConfidenceLevel->p, probability-p confidence intervals are computed for parameter and prediction intervals.
  • With the setting DispersionEstimatorFunction->f, the common dispersion is estimated by f[y,,w] where y={y1,y2,…} is the list of observations, ={,,…} is the list of predicted values, and w={w1,w2,…} is the list of weights for the measurements yi.
  • Possible settings for ExponentialFamily include: "Gaussian", "Binomial", "Poisson", "Gamma", "InverseGaussian", or "QuasiLikelihood".
  • Properties
  • Properties related to data and the fitted function obtained using model["property"] include:
  • "BasisFunctions"list of basis functions
    "BestFit"fitted function
    "BestFitParameters"parameter estimates
    "Data"the input data or design matrix and response vector
    "DesignMatrix"design matrix for the model
    "Function"best fit pure function
    "LinearPredictor"fitted linear combination
    "Response"response values in the input data
    "Weights"weights used to fit the data
  • Properties related to dispersion and model deviances include:
  • "Deviances"deviances
    "DevianceData"deviance table dataset
    "EstimatedDispersion"estimated dispersion parameter
    "NullDeviance"deviance for the null model
    "NullDegreesOfFreedom"degrees of freedom for the null model
    "ResidualDeviance"difference between the deviance for the fitted model and the deviance for the full model
    "ResidualDegreesOfFreedom"difference between the model degrees of freedom and null degrees of freedom
  • Types of residuals include:
  • "AnscombeResiduals"Anscombe residuals
    "DevianceResiduals"deviance residuals
    "FitResiduals"difference between actual and predicted responses
    "LikelihoodResiduals"likelihood residuals
    "PearsonResiduals"Pearson residuals
    "StandardizedDevianceResiduals"standardized deviance residuals
    "StandardizedPearsonResiduals"standardized Pearson residuals
    "WorkingResiduals"working residuals
  • Properties and diagnostics for parameter estimates include:
  • "CorrelationMatrix"asymptotic parameter correlation matrix
    "CovarianceMatrix"asymptotic parameter covariance matrix
    "ParameterEstimates"table of fitted parameter information
  • Properties related to influence measures include:
  • "CookDistances"list of Cook distances
    "HatDiagonal"diagonal elements of the hat matrix
  • Properties of predicted values include:
  • "PredictedResponse"fitted values for the data
  • Properties that measure goodness of fit include:
  • "AdjustedLikelihoodRatioIndex"Ben‐Akiva and Lerman's adjusted likelihood ratio index
    "AIC"Akaike Information Criterion
    "BIC"Bayesian Information Criterion
    "CoxSnellPseudoRSquared"Cox and Snell's pseudo
    "CraggUhlerPseudoRSquared"Cragg and Uhler's pseudo
    "EfronPseudoRSquared"Efron's pseudo
    "LikelihoodRatioIndex"McFadden's likelihood ratio index
    "LikelihoodRatioStatistic"likelihood ratio
    "LogLikelihood"log likelihood for the fitted model
    "PearsonChiSquare"Pearson's statistic
  • The property "BestFit" can also be called as {"prop",x} or {"prop",{x1,x2,…}} to evaluate it at specific independent values.

Examples

open all close all

Basic Examples  (1)

Define a dataset:

Fit a log-linear Poisson model to the data:

See the functional forms of the model:

Evaluate the model at a point:

Plot the data points and the models:

Compute and plot the deviance residuals for the model:

Scope  (15)

Data  (8)

Fit data with success probability responses, assuming increasing integer-independent values:

This is equivalent to:

Fit a model of more than one variable:

Fit data to a linear combination of functions of predictor variables:

Fit a list of rules:

Fit a rule of input values and responses:

Specify a column as the response:

Fit a model with categorical predictor variables:

Obtain a deviance table for the model:

Fit a model given a design matrix and response vector:

See the functional form:

Fit the model referring to the basis functions as x and y:

Obtain a list of available properties for a generalized linear model:

Properties  (7)

Data & Fitted Functions  (1)

Fit a generalized linear model:

Extract the original data:

Obtain and plot the best fit:

Obtain the fitted function as a pure function:

Get the design matrix and response vector for the fitting:

Residuals  (1)

Examine residuals for a fit:

Visualize the raw residuals:

Visualize Anscombe residuals and standardized Pearson residuals in stem plots:

Dispersion and Deviances  (1)

Fit a gamma regression model to some data:

Obtain the estimated dispersion:

Plot the deviances for each point:

Get a dataset of the deviance table:

Get the residual deviances from the table:

Parameter Estimation Diagnostics  (1)

Obtain a formatted table of parameter information:

Extract the column of z-statistic values:

Influence Measures  (1)

Fit some data containing extreme values to a logit model:

Check Cook distances to identify highly influential points:

Check the diagonal elements of the hat matrix to assess influence of points on the fitting:

Prediction Values  (1)

Fit an inverse Gaussian model:

Plot the predicted values against the observed values:

Goodness-of-Fit Measures  (1)

Obtain a table of goodness-of-fit measures for a log-linear Poisson model:

Compute goodness-of-fit measures for all subsets of predictor variables:

Rank the models by AIC:

Generalizations & Extensions  (1)

Perform other mathematical operations on the functional form of the model:

Integrate symbolically and numerically:

Find a predictor value that gives a particular value for the model:

Options  (10)

ConfidenceLevel  (1)

The default gives 95% confidence intervals:

Use 99% intervals instead:

Set the level to 90% within FittedModel:

CovarianceEstimatorFunction  (1)

Fit a generalized linear model:

Compute the covariance matrix using the expected information matrix:

Use the observed information matrix instead:

DispersionEstimatorFunction  (1)

Fit a binomial model:

Compute the covariance matrix:

Compute the covariance matrix estimating the dispersion by Pearson's :

ExponentialFamily  (1)

Fit data to a simple linear regression model:

Fit to a canonical gamma regression model:

Fit to a canonical inverse Gaussian regression model:

IncludeConstantBasis  (1)

Fit a simple linear regression model:

Fit the linear model with intercept zero:

LinearOffsetFunction  (1)

Fit data to a canonical gamma regression model:

Fit data to a gamma regression model with a known Sqrt[x] term:

LinkFunction  (1)

Fit a Poisson model with canonical Log link:

Use a named link:

Use a pure function for a shifted Sqrt link:

NominalVariables  (1)

Fit the data treating the first variable as a nominal variable:

Treat both variables as nominal:

Weights  (1)

Fit a model using equal weights:

Give explicit weights for the data points:

WorkingPrecision  (1)

Use WorkingPrecision to get higher precision in parameter estimates:

Obtain the fitted function:

Reduce the precision in property computations after the fitting:

Applications  (2)

Simulate some probability data:

Fit and visually compare binomial generalized linear models with a variety of link functions:

Fit count data from a contingency table to a Poisson log-linear model:

Display counts, predicted values, and standardized residuals in a tabular form:

Properties & Relations  (5)

DesignMatrix constructs the design matrix used by GeneralizedLinearModelFit:

By default, GeneralizedLinearModelFit and LinearModelFit fit equivalent models:

A default "Binomial" model is equivalent to the model for LogitModelFit:

ProbitModelFit is equivalent to a "Binomial" model with "ProbitLink":

GeneralizedLinearModelFit will use the time stamps of a TimeSeries as variables:

Rescale the time stamps and fit again:

Find fit for the values:

GeneralizedLinearModelFit acts pathwise on a multipath TemporalData:

See Also

FittedModel  LogitModelFit  ProbitModelFit  LinearModelFit  NonlinearModelFit  TimeSeriesModelFit  Fit  LeastSquares  FindFit

Methods: LinearRegression

Tech Notes

    ▪
  • Statistical Model Analysis

Related Guides

    ▪
  • Statistical Model Analysis
  • ▪
  • Statistical Data Analysis
  • ▪
  • Scientific Data Analysis
  • ▪
  • Numerical Data
  • ▪
  • Matrix-Based Minimization
  • ▪
  • Tabular Modeling
  • ▪
  • Supervised Machine Learning

History

Introduced in 2008 (7.0) | Updated in 2023 (13.3) ▪ 2025 (14.2)

Wolfram Research (2008), GeneralizedLinearModelFit, Wolfram Language function, https://reference.wolfram.com/language/ref/GeneralizedLinearModelFit.html (updated 2025).

Text

Wolfram Research (2008), GeneralizedLinearModelFit, Wolfram Language function, https://reference.wolfram.com/language/ref/GeneralizedLinearModelFit.html (updated 2025).

CMS

Wolfram Language. 2008. "GeneralizedLinearModelFit." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2025. https://reference.wolfram.com/language/ref/GeneralizedLinearModelFit.html.

APA

Wolfram Language. (2008). GeneralizedLinearModelFit. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/GeneralizedLinearModelFit.html

BibTeX

@misc{reference.wolfram_2025_generalizedlinearmodelfit, author="Wolfram Research", title="{GeneralizedLinearModelFit}", year="2025", howpublished="\url{https://reference.wolfram.com/language/ref/GeneralizedLinearModelFit.html}", note=[Accessed: 01-December-2025]}

BibLaTeX

@online{reference.wolfram_2025_generalizedlinearmodelfit, organization={Wolfram Research}, title={GeneralizedLinearModelFit}, year={2025}, url={https://reference.wolfram.com/language/ref/GeneralizedLinearModelFit.html}, note=[Accessed: 01-December-2025]}

Top
Introduction for Programmers
Introductory Book
Wolfram Function Repository | Wolfram Data Repository | Wolfram Data Drop | Wolfram Language Products
Top
  • Products
  • Wolfram|One
  • Mathematica
  • Notebook Assistant + LLM Kit
  • System Modeler

  • Wolfram|Alpha Notebook Edition
  • Wolfram|Alpha Pro
  • Mobile Apps

  • Wolfram Player
  • Wolfram Engine

  • Volume & Site Licensing
  • Server Deployment Options
  • Consulting
  • Wolfram Consulting
  • Repositories
  • Data Repository
  • Function Repository
  • Community Paclet Repository
  • Neural Net Repository
  • Prompt Repository

  • Wolfram Language Example Repository
  • Notebook Archive
  • Wolfram GitHub
  • Learning
  • Wolfram U
  • Wolfram Language Documentation
  • Webinars & Training
  • Educational Programs

  • Wolfram Language Introduction
  • Fast Introduction for Programmers
  • Fast Introduction for Math Students
  • Books

  • Wolfram Community
  • Wolfram Blog
  • Public Resources
  • Wolfram|Alpha
  • Wolfram Problem Generator
  • Wolfram Challenges

  • Computer-Based Math
  • Computational Thinking
  • Computational Adventures

  • Demonstrations Project
  • Wolfram Data Drop
  • MathWorld
  • Wolfram Science
  • Wolfram Media Publishing
  • Customer Resources
  • Store
  • Product Downloads
  • User Portal
  • Your Account
  • Organization Access

  • Support FAQ
  • Contact Support
  • Company
  • About Wolfram
  • Careers
  • Contact
  • Events
Wolfram Community Wolfram Blog
Legal & Privacy Policy
WolframAlpha.com | WolframCloud.com
© 2025 Wolfram
© 2025 Wolfram | Legal & Privacy Policy |
English