This is machine translation

Translated by Microsoft
Mouse over text to see original. Click the button below to return to the English verison of the page.


Class: GeneralizedLinearModel

Confidence intervals of coefficient estimates of generalized linear model


ci = coefCI(mdl)
ci = coefCI(mdl,alpha)


ci = coefCI(mdl) returns confidence intervals for the coefficients in mdl.

ci = coefCI(mdl,alpha) returns confidence intervals with confidence level 1 - alpha.

Input Arguments


Generalized linear model, as constructed by fitglm or stepwiseglm.


Scalar from 0 to 1, the probability that the confidence interval does not contain the true value.

Default: 0.05

Output Arguments


k-by-2 matrix of confidence intervals. The jth row of ci is the confidence interval of coefficient j of mdl. The name of coefficient j of mdl is in mdl.CoefficientNames.


Confidence Interval

Assume that model assumptions hold (data comes from a generalized linear model represented by the formula mdl.Formula and the specified link function, and with observations that are independent conditional on the predictor values). Then row j of the confidence interval matrix ci gives a confidence interval [ci(j,1),ci(j,2)] computed such that, with repeated experimentation, a proportion 1 - alpha of the intervals will contain the true value of the coefficient.


expand all

Find confidence intervals for the coefficients of a fitted generalized nonlinear model.

Generate artificial data for the model using Poisson random numbers with two underlying predictors X(1) and X(2).

rng('default') % for reproducibility
rndvars = randn(100,2);
X = [2+rndvars(:,1),rndvars(:,2)];
mu = exp(1 + X*[1;2]);
y = poissrnd(mu);

Create a generalized linear regression model of Poisson data.

mdl = fitglm(X,y,...
    'y ~ x1 + x2','distr','poisson')
mdl = 

Generalized Linear regression model:
    log(y) ~ 1 + x1 + x2
    Distribution = Poisson

Estimated Coefficients:
                   Estimate    SE           tStat     pValue
    (Intercept)    1.0405       0.022122    47.034    0     
    x1             0.9968       0.003362    296.49    0     
    x2              1.987      0.0063433    313.24    0     

100 observations, 97 error degrees of freedom
Dispersion: 1
Chi^2-statistic vs. constant model: 2.95e+05, p-value = 0

Find 95% (default) confidence intervals on the coefficients of the model.

ci = coefCI(mdl)
ci =

    0.9966    1.0844
    0.9901    1.0035
    1.9744    1.9996

Find 99% confidence intervals on the coefficients.

alpha = .01;
ci = coefCI(mdl,alpha)
ci =

    0.9824    1.0986
    0.9880    1.0056
    1.9703    2.0036

Related Examples

Was this topic helpful?