Esta página aún no se ha traducido para esta versión. Puede ver la versión más reciente de esta página en inglés.

devianceTest

Analysis of deviance

Sintaxis

tbl = devianceTest(mdl)

Description

tbl = devianceTest(mdl) returns an analysis of deviance table for the mdl generalized linear model. tbl gives the result of a test of whether the fitted model fits significantly better than a constant model.

Argumentos de entrada

mdl

Generalized linear model, specified as a full GeneralizedLinearModel object constructed using fitglm or stepwiseglm, or a compacted CompactGeneralizedLinearModel object constructed using compact.

Output Arguments

tbl

Table containing two rows and four columns.

  • The first row relates to a constant model.

  • The second row relates to the full model in mdl.

  • The columns are:

    DevianceDeviance is twice the difference between the log likelihoods of the corresponding model (mdl or constant) and the saturated model. The test statistic for the deviance test is twice the difference between the log likelihoods of the tested model mdl and the constant model. For more information, see Deviance.
    DFEError degrees of freedom. It is the number of observations minus the number of parameters in the corresponding model.
    chi2Stat

    F statistic or Chi-squared statistic, depending on whether the dispersion is estimated (F statistic) or not (Chi-squared statistic)

    • Chi-squared statistic is the difference between the deviance of the constant model and the deviance of the full model.

    • F statistic is the difference between the deviance of the constant model and the deviance of the full model, divided by the estimated dispersion.

    pValuep-value associated with the test. It is the Chi-squared statistic with (number of coefficients in the model minus one) degrees of freedom, or F statistic with (number of coefficients in the model minus one) numerator degrees of freedom, and DFE denominator degrees of freedom.

Ejemplos

expandir todo

Perform a deviance test on a generalized linear model.

Construct a generalized linear model.

rng('default') % for reproducibility
X = randn(100,5);
mu = exp(X(:,[1 4 5])*[.4;.2;.3]);
y = poissrnd(mu);
mdl = fitglm(X,y,'linear','Distribution','poisson');

Test whether the model differs from a constant in a statistically significant way.

tbl = devianceTest(mdl)
tbl=2×4 table
                                           Deviance    DFE    chi2Stat      pValue  
                                           ________    ___    ________    __________

    log(y) ~ 1                              128.58     99                           
    log(y) ~ 1 + x1 + x2 + x3 + x4 + x5     83.726     94      44.858     1.5502e-08

The -value is very small, indicating that the model significantly differs from a constant.

Más acerca de

expandir todo