This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.


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, specified as a full GeneralizedLinearModel object constructed using fitglm or stepwiseglm, or a compacted CompactGeneralizedLinearModel object constructed using compact.


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.


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 = 3×2

    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 = 3×2

    0.9824    1.0986
    0.9880    1.0056
    1.9703    2.0036

More About

expand all