The GLM Tab

The GLM tab fits generalized linear models (GLMs) to response variables that cannot be assumed to follow a normal distribution, such as binary outcomes, counts, and positive continuous values. A GLM extends the linear model by specifying a distribution family and a link function for the response variable. GLM Fundamentals explains the mathematical background.

OLS regression in the Linear Regression tab is the same model as a GLM with the Gaussian family and the Identity link. When the response is continuous and a normal distribution is a reasonable assumption, you can use the Linear Regression tab.

Distribution Families

Distribution Family selects the family that matches the data type of the response variable. There are five options.

Family (UI label)Description
Gaussian (Normal)Use it for continuous values such as height or temperature
Binomial (Logistic)Use it for binary (0/1) responses such as whether a purchase was made or an inspection passed. Pairs of successes and trials are also supported. This is logistic regression.
Poisson (Count)Use it for count data. It is commonly used to model counts such as inquiries or accidents per day. This is Poisson regression.
Gamma (Positive Continuous)Use it for positive continuous values with a long right tail, such as waiting times or repair costs
Negative Binomial (Overdispersed Count)Use it for overdispersed count data, when the Poisson assumption that the variance equals the mean does not hold

The Binomial family offers a Response format choice. Binary (0/1) fits per-observation 0/1 data, and Grouped (n trials) fits data aggregated into successes and trials. Selecting Grouped replaces Response Variable (Y) with a Successes column and a Trials column. See Analyzing Successes-and-Trials Data with Logistic Regression for a worked example.

The Link Function options depend on the distribution family. Changing the family automatically switches the link function to that family's default.

FamilyDefaultAvailable links
GaussianIdentityIdentity, Log
BinomialLogitLogit, Probit
PoissonLogLog, Identity
GammaInverseInverse, Log, Identity
Negative BinomialLogLog

The link function connects the linear predictor to the expected value of the response. See GLM Fundamentals: Choosing a Link Function for guidance on reading effects as differences versus ratios and for the properties of canonical links.

Basic Usage

The examples below use the Auto MPG dataset. Opening the link launches MIDAS with this dataset loaded.

Opening GLM

Select Analysis > Generalized Linear Model (GLM)... from the menu bar.

Setting Up the Analysis

GLM form

Dataset selects the dataset to analyze.

Response Variable (Y) selects the response variable. Only numeric columns (interval or ratio scale) can be selected. For the Binomial family, use a column containing 0/1 values1. Fit a proportion of successes out of a known number of trials with Grouped, using a successes column and a trials column.

Predictor Variables (X) selects the predictors with checkboxes. Categorical columns (nominal or ordinal scale) and date columns cannot be selected; convert them to numeric variables in the Dummy Coding tab first. As with the response variable, boolean columns become selectable when their scale is changed to interval1.

Distribution Family and Link Function select the family and the link. See Distribution Families and Link Functions for the options.

Include intercept toggles the intercept term. It is on by default.

Confidence Level sets the level of the coefficient confidence intervals. The default is 95%, and values from 50 to 99.99% can be specified.

Max Iterations and Convergence Tolerance are the iteration limit and the convergence threshold of the estimation algorithm. Convergence Tolerance is the upper limit on Δβ^⊤V^−1Δβ^\sqrt{\Delta\hat\beta^\top \hat V^{-1} \Delta\hat\beta}, the size of the change Δβ^\Delta\hat\beta that one more update would make to the coefficients, measured by their estimated covariance matrix V^\hat V. In a model with one coefficient, this size is the change divided by the standard error. For the combinations of family and link function that are estimated by iteration, changing this value changes the coefficient estimates and the number of iterations. The defaults are 100 iterations and 1e-6. See Convergence Issues for adjustments when the fit does not converge with the defaults.

Negative Binomial Settings

Selecting the Negative Binomial family shows settings for the shape parameter θ. The parameter θ controls the degree of overdispersion; see GLM Fundamentals: Variance Functions and Overdispersion for its statistical meaning.

By default, θ is estimated automatically by profile likelihood. See GLM Fundamentals: The Exponential Family for how the estimation works. Turning on Manually specify θ lets you enter θ in the range 0.1 to 100. Manual specification is useful for sensitivity analysis, where you check how the results change with θ, and for model comparison with a fixed θ.

Offset Variable

Offset Variable specifies a column added to the linear predictor with its coefficient fixed at 1. An offset is not an estimated parameter but a known value for each observation.

The typical use case is rate modeling in Poisson regression. Suppose you compare failure counts across machines: when operating hours differ from machine to machine, raw counts are not comparable. A machine with 5 failures in 100 hours fails more often per hour than one with 10 failures in 1,000 hours.

The offset accounts for the differing operating hours. With the failure count as the response and the log of operating hours, log(hours), as the offset, the model describes the failure rate per hour rather than the raw count.

In this model, exp⁡(β^)\exp(\hat\beta) can be interpreted as a rate ratio. With a predictor indicating whether a machine has a maintenance contract, an estimated exp⁡(β^)\exp(\hat\beta) of 0.8 means the failure rate of machines with a contract is estimated to be 0.8 times that of machines without one.

The offset also affects the null deviance (the deviance of the model with only the intercept and the offset), so its value differs from the model without an offset.

When you run predictions with an offset model, the prediction dataset must contain an offset column with the same name.

Running the Analysis

When the settings are complete, click Run GLM. Parameters are estimated with IRLS (Iteratively Reweighted Least Squares). See GLM Fundamentals: Parameter Estimation for the algorithm.

When the estimation finishes, the Convergence History at the end of the results section lists the deviance and the coefficients at each iteration. Save History as Dataset saves this history as a dataset under the name entered in a dialog.

Changing the variable selection or the model settings after a run makes the displayed results no longer belong to the current settings. MIDAS removes those results from the view and shows a message asking you to run the analysis again. Restoring the previous settings brings the results back. Changing Dataset also resets the variable selection, so the results are discarded instead. Changing Confidence Level keeps the results.

Understanding Results

GLM results

Model Summary

The Model Summary lists goodness-of-fit indicators.

Convergence shows whether the estimation converged, together with the number of IRLS iterations. For Negative Binomial with estimated θ, it shows convergence when both the search for θ and IRLS converged. If the fit did not converge, the coefficients and standard errors are not reliable.

Residual Deviance is a goodness-of-fit measure based on the log-likelihood difference from the saturated model. See GLM Fundamentals for details.

AIC is the Akaike information criterion; smaller values indicate a better balance between fit and model complexity. AIC can be compared between models of the same distribution family, and between Poisson and Negative Binomial models, fitted to the same response on the same observations. For Binomial, the models must also have the same Response format2.

Shape Parameter (θ) appears only for Negative Binomial and indicates whether the value was estimated or manually specified.

In-Sample Prediction Accuracy Metrics

Right after Run, the results show prediction accuracy metrics computed on the fitting data itself, labeled Prediction Accuracy Metrics. The metrics depend on the distribution family and use the same definitions as the prediction accuracy metrics: Gaussian shows R², RMSE, and MAE; Binomial shows the Brier Score and AUC; Gamma, Poisson, and Negative Binomial show RMSE, MAE, and Mean Deviance. See Prediction Accuracy Metrics for the definition and interpretation of each metric.

Because these metrics describe the fit to the data the model was fitted on, a note stating this is always shown. Metrics on data not used for fitting are typically less favorable. To evaluate predictive performance on data not used for fitting, run a prediction against a different dataset.

Some Gaussian metrics use definitions that differ from the Linear Regression tab. The RMSE divides by the number of observations n, while the Linear Regression tab reports the residual standard error, which divides the same residual sum of squares by the residual degrees of freedom n − p, so the two values differ for the same model unless that sum is 0. The R² baseline is the mean of the observed values regardless of whether the model has an intercept, so for no-intercept models it does not match the Linear Regression tab's uncentered R².

When the response's variation is below floating-point precision relative to its magnitude, R², RMSE, and MAE cannot be computed and are shown as "-".

For Binomial models, a ROC curve appears below the metrics when the AUC can be computed. The curve uses the same definition as the ROC curve in prediction results, weighted by trials for the successes-and-trials format. When only one class is observed, the AUC shows "-" and a note appears instead of the curve.

Coefficients

The coefficient table shows the following columns.

ColumnContent
VariableVariable name. The intercept is "(Intercept)".
EstimateCoefficient estimate, on the link function scale
Std. ErrorWald standard error
Lower N% / Upper N%Wald confidence interval, where N is the chosen confidence level
OR / IRR / exp(Est.)exp⁡(β^)\exp(\hat\beta), shown depending on the link function
exp(Lower N%) / exp(Upper N%)The confidence interval transformed by exp⁡\exp
VIFVariance inflation factor, a diagnostic for multicollinearity

The exp⁡(β^)\exp(\hat\beta) column is labeled odds ratio (OR) for the Logit link, incidence rate ratio (IRR) for the Log link with Poisson and Negative Binomial, and multiplicative effect exp(Est.) for the Log link with Gaussian and Gamma. The column is not shown for the Identity, Inverse, and Probit links.

The VIF (variance inflation factor) shows how much the correlation among predictors inflates the estimated variance of each coefficient. MIDAS computes the VIF from the variance-covariance matrix of the coefficients, which for GLMs is built from the IRLS weights at the final estimates. The GLM VIF therefore measures the correlation among predictors when each observation is weighted by its IRLS weight. With Rj2R_j^2 the coefficient of determination from the weighted regression of XjX_j on the remaining predictors with an intercept, the VIF is 1/(1−Rj2)1/(1 - R_j^2). The weights depend on the family, the link, and the fitted values, so the same set of predictors can give different VIFs in different models. For the Gaussian family with the Identity link and the Gamma family with the Log link, the weights are all equal and the VIF equals the OLS VIF. See OLS Fundamentals: Multicollinearity and VIF for interpretation.

When the VIF cannot be computed, MIDAS shows "-" for the whole column and states the reason below the coefficient table. The intercept row is not covered by the VIF and is always "-", with no reason shown.

Confidence intervals are based on the t distribution for families whose dispersion parameter is estimated from the data, and on the standard normal distribution otherwise. See GLM Fundamentals: Coefficient Standard Errors and Confidence Intervals for the calculation details.

The display format of each numeric column in the coefficient table can be changed per column. Right-clicking a column header opens presets such as fixed decimals and significant digits. The chosen format is stored in the tab and persists when the model is rerun.

Interpreting Coefficients

Coefficients are estimated on the link function scale, so their interpretation depends on the link.

LinkInterpretation
Identityβ^\hat\beta is the change in the expected response itself, the same interpretation as OLS
Logitβ^\hat\beta is the change in the log odds, and exp⁡(β^)\exp(\hat\beta) is the odds ratio
Logexp⁡(β^)\exp(\hat\beta) is the multiplicative change in the expected response
Inverse, ProbitDirect interpretation of the coefficients is difficult; interpreting through predicted values is practical

See GLM Fundamentals: Choosing a Link Function for the effect-measure perspective of reading effects as differences versus ratios.

Saving the Coefficient Table and Reports

The coefficient table can be saved as a dataset with Save as Dataset and exported to CSV. The saved dataset contains the columns Variable, Estimate, Std. Error, Lower N%, Upper N%, and VIF; with the Logit and Log links, the exp-transformed columns are also included.

Saving the coefficient dataset requires saving the model. If the model has not been saved yet, a dialog asks for a model name and saves the model and the dataset together. The coefficient dataset is tied to the model: deleting the model deletes the dataset with it, and refitting the model updates the dataset with the new results.

Add to Report adds the coefficient table to a report. This also requires the model to be saved.

Saving Models and Diagnostics

Saving the Model

Enter a model name in Model Name and click Save Model. A name in the form "GLM: Y ~ X1 + X2 (Family, link)" is generated automatically, so you can use it as is. If a model with the same settings (dataset, response variable, predictors, family, link, and intercept) already exists, a confirmation dialog asks about overwriting it.

After Saving

After saving the model, two buttons appear: View Model Details and View Diagnostics.

View Model Details opens the Model Detail tab. Changing the Confidence Level input in the Model Detail tab recalculates the confidence intervals and column headers on the fly from the saved coefficients and standard errors. The values saved in the model do not change. From the Model Detail tab you can also add the coefficient table to a report with Add to Report and run predictions with Make Predictions.

View Diagnostics opens the GLM Diagnostics tab, which shows residual diagnostic plots.

Diagnostic Dataset

Save as Dataset at the bottom of the GLM Diagnostics tab saves to the project a derived dataset that adds diagnostic statistics columns to the original dataset. Adding one of the four diagnostic plots to a report, or saving a Contributing rows tab opened from the diagnostic plots, also saves the same dataset. Save as Dataset under each binned residual plot saves a table of bins instead. The added columns are as follows.

ColumnContent
fitted_valuesPredicted values, on the response scale
deviance_residualsDeviance residuals
pearson_residualsPearson residuals
response_residualsResponse residuals (observed value minus fitted value). The vertical axis of the binned residual plots is the mean of this column in each bin.
standardized_residualsStandardized residuals (deviance-based)
sqrt_abs_std_residualsSquare root of the absolute standardized residuals, the vertical axis of the Scale-Location plot
standardized_pearson_residualsStandardized residuals (Pearson-based)
sqrt_abs_std_pearson_residualsSquare root of the absolute Pearson-based standardized residuals
leverageLeverage (diagonal elements of the hat matrix)
cooks_distanceCook's Distance (deviance-based)
cooks_distance_pearsonCook's Distance (Pearson-based)

When the original dataset already has a column with one of these names, including a name that differs only in uppercase and lowercase letters (A to Z), the diagnostic column gets a sequential number, such as leverage_1.

The Pearson-based columns correspond to the diagnostic plots when Pearson is chosen in the residual type selection. The dispersion parameter used for standardization depends on the family; see GLM Fundamentals: Coefficient Standard Errors and Confidence Intervals for details.

Diagnostic Plots

Clicking View Diagnostics opens the GLM Diagnostics tab, which shows four diagnostic plots for every model. As with OLS, the four plots are used to check the model fit, the variance assumption, and the influence of outliers. For a Binomial model with the Binary response format, the tab also shows two binned residual plots before the four plots.

GLM diagnostic plots

Binned Residual Plots

For a Binomial model with the Binary response format, a lack of fit cannot be read from Residuals vs Fitted and Scale-Location and is read from the binned residual plots instead. The residuals of such a model take only two values at each fitted value, one for a response of 0 and one for a response of 1. The points of those two plots therefore split into two bands whatever the fit, and the shape of the bands does not show the fit.

Binned residual plots

A binned residual plot sorts the observations by the value on the horizontal axis, divides them into bins, and plots the mean response residual of each bin (Gelman et al., 2000, pp. 253–254). The left plot has the fitted probability on the horizontal axis, and the right plot has the predictor chosen in the drop-down list. Only the predictors in the model can be chosen, so this plot does not show how the residuals change with a variable outside the model. For NN observations used in the fit, the plot uses at most ⌊N⌋\lfloor \sqrt{N} \rfloor bins. MIDAS makes the bins about equal in size but always puts observations with the same value into the same bin. When many observations share a value, those observations therefore form one large bin. The vertical position of a point is the proportion of observations with a response of 1 in the bin minus the mean fitted probability. The horizontal position is the mean of the values on the horizontal axis in the bin.

The dashed lines lie at ±2 times the standard deviation of the mean residual of a bin, assuming that the observations are independent and that the fitted probabilities equal the true probabilities. For bin jj with njn_j observations whose fitted probabilities are p^i\hat{p}_i, the lines lie at ±2∑ip^i(1−p^i)/nj\pm 2\sqrt{\sum_i \hat{p}_i(1 - \hat{p}_i)} / n_j. Gelman et al. (2000) obtain the corresponding range by posterior predictive simulation, whereas MIDAS computes the lines by this formula with the coefficients fixed at their estimates. Some points can fall outside the lines even when the model is correct, so look for curves across bins rather than at single points.

As a guide to the variation of the mean residuals, the dashed lines have the following three limitations.

  • Each residual is the difference from a fitted probability estimated from data that include the observation itself, so its variance is smaller than that of the difference from the true probability. For an observation with leverage hih_i, the variance is about (1−hi)(1 - h_i) times as large. The mean residuals therefore vary less than the lines show, and fewer points fall outside the lines than the lines suggest
  • When observations in the same bin are positively correlated, such as repeated measurements of the same subjects, the mean residuals vary more than the lines show
  • In a bin with few observations or with fitted probabilities close to 0 or 1, the distribution of the mean residual is far from a normal distribution, so the proportion of points outside the lines cannot be derived from the normal distribution

A curve of the mean residuals against the fitted probability can come from a wrong link function, a missing interaction, or a missing predictor.

A curve of the mean residuals in the predictor plot can come from a nonlinear effect of the predictor, a missing interaction, a missing variable correlated with the predictor, or a wrong link function.

In a model with the Logit link, an intercept, and no offset, what both plots mainly show is curves. With yiy_i the response of observation ii and xikx_{ik} the value of its kkth predictor, the estimates of a converged fit nearly satisfy the score equations ∑ixik(yi−p^i)=0\sum_i x_{ik}(y_i - \hat{p}_i) = 03. Because the intercept column is always 1, the residuals have nearly zero sample covariance with each predictor in the model and with the linear predictor, which is a linear combination of the predictors. The residuals therefore have almost no straight-line relation to the horizontal axis of a predictor plot or to the linear predictor that determines the fitted probabilities. The fitted probability is a nonlinear transformation of the linear predictor, however, and the points are bin means, so the slope through the points is not necessarily 0. A small slope follows from the fitting method itself, so the absence of a slope alone does not show a good fit.

For the same reason, the points of the following two plots lie near 0 whatever the fit. One is the plot of a predictor that takes only the values 0 and 1 in the model: the predictor is constant within each bin, so the mean residuals of both bins are near 0. The other is the fitted-probability plot of a model with categorical predictors and all their interactions, which estimates a separate probability for every combination of values: observations of the same combination share a fitted probability and go into the same bin, and the residuals of each combination sum to nearly 0.

Residual Type Selection and Point Selection do not affect the binned residual plots, because these plots use only the response residuals and their points represent bins rather than observations.

Save as Dataset under each plot saves a derived dataset with one row per bin of the plot to the project. Adding the plot to a report also saves this dataset for the report to refer to. For the predictor plot, the bins of the predictor selected at that time are saved. The dataset has the following columns.

ColumnContents
binBin number, from 1 in increasing order of the values on the horizontal axis
x_meanMean of the values on the horizontal axis of the observations in the bin
x_minMinimum of the values on the horizontal axis of the observations in the bin
x_maxMaximum of the values on the horizontal axis of the observations in the bin
nNumber of observations in the bin, njn_j
mean_residualMean response residual of the bin
lower_2sePosition of the lower dashed line, −2 times the standard deviation of the mean residual of the bin
upper_2sePosition of the upper dashed line, 2 times the standard deviation of the mean residual of the bin

Residual Type Selection

The residual type of the diagnostic plots can be switched between Deviance (default) and Pearson. Switching updates all four plots. Deviance residuals are likelihood-based residuals. Pearson residuals standardize the difference between observed and expected values by the variance function and are useful for diagnosing overdispersion. See the glossary for the definitions of the two residual types and the difference between them.

The Four Plots

Residuals vs Fitted

This plot shows the fitted values on the horizontal axis and the residuals on the vertical axis. A curved pattern indicates a misspecified mean structure (link function or predictor terms). A funnel-shaped pattern arises when the variance function of the family does not match the data, and also from small expected counts or few trials even when the model holds.

Normal Q-Q Plot

This plot compares the quantiles of the standardized residuals with theoretical normal quantiles to check normality. It is shown only for the Gaussian family.

Scale-Location

This plot shows the fitted values on the horizontal axis and the square root of the absolute standardized residuals on the vertical axis. A trend arises when the variance function does not match the data, and also from a misspecified mean structure or from small expected counts or few trials.

Residuals vs Leverage

This plot shows the leverage on the horizontal axis and the standardized residuals on the vertical axis, with Cook's Distance contours overlaid (D = 0.5: orange dashed, D = 1.0: red dashed). The leverage hih_i is the diagonal element of the hat matrix W1/2X(X⊤WX)−1X⊤W1/2W^{1/2}X(X^\top W X)^{-1}X^\top W^{1/2}, where WW is the diagonal matrix of the IRLS weights evaluated at the converged estimates. Cook's Distance is Di=ri2hi/(p(1−hi))D_i = r_i^2 h_i / (p(1 - h_i)), where rir_i is the standardized residual of the type selected in Residual Type and pp is the number of coefficients counting the intercept. When you select Pearson in Residual Type, DiD_i is the Cook's Distance of a refit without the observation, computed with the one-step approximation of the refitted coefficients. When no contour is visible before you zoom or pan, every plotted observation has a Cook's Distance below 0.5.

For an observation with leverage 1, the standardized residual and Cook's Distance cannot be computed, so MIDAS shows them as "-" and omits the observation from the plots that use standardized residuals. To find such observations, check the leverage column of the diagnostic dataset.

Point Selection

Clicking or rectangle-selecting data points on any plot shows the details of the corresponding observations (fitted value, residual, leverage, Cook's Distance, and more) in a table below the plots. The selection state is synchronized across the four plots.

Points selected on the diagnostic plots are also selected, as the rows of the same observations, in the dataset the model was fitted to. Rows selected in the Data Table tab, on the other hand, are not highlighted on the diagnostic plots. See Row Selection and the Filtered Data Tab for how far selections are shared.

Double-clicking a point opens a Contributing rows tab that shows the row of that observation. When other observations have the same plotted values as that point, the tab shows their rows as well. When MIDAS has recorded a condition for the selection, Open as Filtered Data in the plot's context menu opens the rows of all the selected observations. The operations that make MIDAS record a condition are described in Selection Conditions.

The rows in the Contributing rows tab are rows of the dataset the model was fitted to, and Save as Dataset saves them as a derived dataset. The saved derived dataset traces its rows through the diagnostic dataset, so MIDAS saves the diagnostic dataset to the project as well. As a result, deleting the model also deletes the saved derived dataset.

Deviance Goodness-of-Fit

For the Poisson and Binomial families, and for Negative Binomial with a manually specified θ, the GLM Diagnostics tab shows the Deviance/df ratio, the residual deviance divided by the residual degrees of freedom. A ratio near 1 indicates that the variation in the data is consistent with the model's assumption. A ratio much larger than 1 suggests overdispersion; for Poisson data, consider switching to Negative Binomial, and for Negative Binomial with a manually specified θ, consider a smaller θ or automatic estimation of θ. See GLM Fundamentals: Variance Functions and Overdispersion for the meaning of overdispersion and the theory behind the diagnosis.

For Binomial models with binary data (one trial per observation), the Deviance/df ratio is not a reliable goodness-of-fit indicator. For a model with the Binary response format, the binned residual plots show how the observed proportions differ from the fitted probabilities.

Prediction

A saved GLM model can be used to predict on new data.

GLM prediction

Running Predictions

  1. Open the Model Detail tab with View Model Details.
  2. Click Make Predictions to open the GLM Prediction tab.
  3. Select the dataset to predict on. Only datasets that have the same predictor column names as the fitted model, with those columns of numeric (int64, float64) or boolean type, can be selected. Boolean columns are read as true = 1 and false = 0.
  4. Configure the output. Output Dataset Name is the name of the result dataset. Include original data controls whether the original columns are included in the result. Confidence Interval Levels and Prediction Interval Levels select interval levels from 90%, 95%, and 99%.
  5. Run the prediction with Run Prediction.

When the prediction succeeds, the tab shows the name of the created dataset, its number of rows, and the number of rows without a prediction (Skipped Rows) in the Prediction Result box. Rows without a prediction are rows with a missing predictor or offset value and rows where the linear predictor is 0 or less and the mean is therefore not positive, as described in Prediction Output. These rows stay in the result, and their predicted values are missing.

After a successful prediction, Open Result Dataset takes the place of the run button and opens the result dataset in a Data Table tab. Changing the dataset to predict on, Include original data, or an interval level, or a change to the model or to the dataset to predict on, turns the button back into Run Prediction.

Output Dataset Name must differ from the names of existing datasets. When the default name matches an existing dataset, the tab appends a number such as (1). After a successful prediction, the field changes to the name with the next number appended, so you can change the settings and predict again without editing the name.

Prediction Output

The prediction results are saved as a dataset. The results contain the predicted values on the response scale, confidence intervals for the mean response, and prediction intervals for new observations. The confidence interval expresses the uncertainty in estimating the population mean at the given predictor values, while the prediction interval also includes the variability of individual observations.

For Binomial models, when the prediction dataset contains the response variable column (and the trials column for the successes-and-trials format), the results also include observed-outcome columns. Binary responses add a glm_observed column (0/1; boolean responses are mapped to 0/1), and the successes-and-trials format adds a glm_observed_proportion column (successes ÷ trials) and a glm_trials column. These columns are added even when Include original data is off, and support comparing predictions with observations and viewing the ROC curve.

Most prediction intervals are computed with a plug-in method that does not account for parameter estimation uncertainty, so the intervals can be narrower than they should be for small samples or extrapolation points. See GLM Fundamentals: Confidence and Prediction Intervals for the calculation methods and reference distributions.

For models with the Inverse link and for Gamma or Poisson models with the Identity link, some rows can have a missing predicted value or a missing confidence limit on one side. This is because the mean of these models is positive only when the linear predictor η\eta is positive. The mean is μ=1/η\mu = 1/\eta with the Inverse link and μ=η\mu = \eta with the Identity link. In rows where η^\hat\eta at the prediction point is 0 or less, μ^\hat\mu is not a positive value that the mean can take. MIDAS does not compute the predicted value, the confidence interval, or the prediction interval for these rows and leaves them missing. In rows where η^\hat\eta is positive but the confidence interval of η\eta reaches 0 or less, one limit of the confidence interval of the mean response is missing. With the Inverse link, the confidence interval has no upper limit, so the upper limit is missing. With the Identity link, the confidence interval consists of every value above 0 up to the upper limit. The value 0 is not a value the mean can take and is not part of the interval, so the lower limit is missing.

With the Inverse link, the prediction interval stays finite even in rows where the upper confidence limit is missing. In these rows, the prediction interval does not reflect that the estimate is uncertain enough for the confidence interval of the mean response to have no upper limit.

Prediction Accuracy Metrics

If the prediction dataset contains the response variable column, accuracy metrics comparing predictions with observations are computed and displayed. The metrics depend on the distribution family. See Prediction Accuracy Metrics for the definition and interpretation of each metric. Metrics with the same definitions also appear right after fitting (In-Sample Prediction Accuracy Metrics).

FamilyMetrics
GaussianR², RMSE, MAE
Gamma, Poisson, Negative BinomialRMSE, MAE, Mean Deviance
BinomialBrier Score, AUC

The Gaussian R² is a predictive R² relative to the mean of the observed values in the prediction dataset itself. It cannot be computed and is shown as "-" when the spread of the observed values falls below floating-point precision relative to their magnitude, or when the sum of squared errors exceeds the range of double precision. See Prediction Accuracy Metrics for why Mean Deviance is shown instead of R² for Gamma, Poisson, and Negative Binomial.

For Binomial, when the observations contain only one class, AUC cannot be computed and is shown as "-". For models fitted in the successes-and-trials format, the Brier Score and AUC are weighted by the number of trials, so the prediction dataset must also contain the trials column.

For Binomial models, the ROC curve appears below the metrics. The curve uses the same definition as the AUC, counting ties as one half and weighting by trials for the successes-and-trials format, so the displayed AUC value equals the area under the curve. When the observations contain only one class, the curve is not shown and a note explains why. When the prediction dataset is the one used to fit the model, the curve, like the metrics, describes the fit to the fitting data. See Prediction Accuracy Metrics for how to read the ROC curve. To build the curve yourself, use the observed-outcome columns in the prediction result dataset with the ROC stat in a Custom Graph.

RMSE, MAE, and Mean Deviance are also shown as "-" when they cannot be computed. RMSE and MAE reach this state when the sum of squared or absolute errors exceeds the range of double precision, and Mean Deviance when a predicted value sits on the boundary of the family's domain and the unit deviance is unbounded.

Notes

Using Categorical Variables

GLM accepts only numeric variables. To use categorical (nominal or ordinal scale) or date/datetime variables as predictors, convert them to numeric dummy variables in the Dummy Coding tab before the analysis.

Automatic Exclusion of Missing and Invalid Values

The GLM tab automatically excludes rows containing missing values (null), non-numeric values, or infinities from the analysis. With Grouped (n trials), it also excludes rows whose trials are 0 or less and rows whose successes are negative or exceed the trials. This exclusion is listwise deletion; see Missing Data Mechanisms for the conditions under which it yields valid estimates.

Convergence Issues

If IRLS does not converge, try the following in order: increase Max Iterations, for example from 100 to 500; and standardize the predictors. Predictors with widely different magnitudes are a major cause of numerical instability.

When count data contain an extreme number of zeros, Poisson and Negative Binomial fits can be difficult.

References

Footnotes

  1. Columns that store binary values as booleans are inferred as nominal scale by default and cannot be selected. Changing the scale to interval in the Data Table makes them selectable, with true = 1 and false = 0. ↩ ↩2

  2. The parameter count k in AIC depends on the family. For Poisson and Binomial it is the number of regression coefficients (including the intercept); for Gaussian and Gamma the dispersion parameter is added. For Negative Binomial, θ is counted only when it is estimated automatically; a manually specified θ is not an estimated parameter and is not counted. Keep this difference in mind when comparing the AIC of a θ-estimated model with a θ-fixed model. ↩

  3. For a converged fit, the vector UU of the left-hand sides of the score equations, measured by the estimated covariance matrix V^\hat V of the coefficients as U⊤V^U\sqrt{U^\top \hat V U}, is at most Convergence Tolerance. The left-hand sides are not exactly 0, so the values described here as near 0 deviate slightly from 0. The estimates of a fit that did not converge do not necessarily satisfy the score equations. ↩