constructs a generalized linear model of the form that fits the yi for successive x values 1, 2, .


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


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

Details and Options

  • 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,].
  • With data in the form {{x_(11),x_(12),... ,y_(1)},{x_(21),x_(22),... ,y_(2)},...}, the number of coordinates xi1, xi2, should correspond to the number of variables xi.
  • Data in the form {y1,y2,} is equivalent to data in the form {{1,y1},{2,y2},}.
  • 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.
  • GeneralizedLinearModelFit takes the following options:
  • AccuracyGoalAutomaticthe accuracy sought
    ConfidenceLevel95/100confidence level for parameters and predictions
    CovarianceEstimatorFunction"ExpectedInformation"estimation method for the parameter covariance matrix
    DispersionEstimatorFunctionAutomaticfunction for estimating the dispersion parameter
    ExponentialFamilyAutomaticexponential family distribution for y
    IncludeConstantBasisTruewhether to include a constant basis function
    LinearOffsetFunctionNoneknown offset in the linear predictor
    LinkFunctionAutomaticlink function for the model
    MaxIterationsAutomaticmaximum number of iterations to use
    NominalVariablesNonevariables considered as nominal
    PrecisionGoalAutomaticthe precision sought
    WeightsAutomaticweights for data elements
    WorkingPrecisionAutomaticthe 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, ={1,2,} 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 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
  • Properties related to dispersion and model deviances include:
  • "Deviances"deviances
    "DevianceTable"deviance table
    "DevianceTableDegreesOfFreedom"degrees of freedom differences from the table
    "DevianceTableDeviances"deviance differences from the table
    "DevianceTableEntries"unformatted array of values from the table
    "DevianceTableResidualDegreesOfFreedom"residual degrees of freedom from the table
    "DevianceTableResidualDeviances"residual deviances from the table
    "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
    "ParameterConfidenceIntervals"parameter confidence intervals
    "ParameterConfidenceIntervalTable"table of confidence interval information for the fitted parameters
    "ParameterConfidenceIntervalTableEntries"unformatted array of values from the table
    "ParameterConfidenceRegion"ellipsoidal parameter confidence region
    "ParameterTableEntries"unformatted array of values from the table
    "ParameterErrors"standard errors for parameter estimates
    "ParameterPValues"pvalues for parameter z-statistics
    "ParameterTable"table of fitted parameter information
    "ParameterZStatistics"z-statistics for parameter estimates
  • 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"BenAkiva 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
  • 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,}].


open allclose all

Basic Examples  (1)

Define a dataset:

Click for copyable input

Fit a log-linear Poisson model to the data:

Click for copyable input

See the functional forms of the model:

Click for copyable input

Evaluate the model at a point:

Click for copyable input

Plot the data points and the models:

Click for copyable input

Compute and plot the deviance residuals for the model:

Click for copyable input
Click for copyable input

Scope  (11)

Generalizations & Extensions  (1)

Options  (10)

Applications  (2)

Properties & Relations  (5)

See Also

FittedModel  LogitModelFit  ProbitModelFit  LinearModelFit  NonlinearModelFit  TimeSeriesModelFit  Fit  LeastSquares  FindFit


Introduced in 2008