Stata 15 help for nestreg

[R] nestreg -- Nested model statistics


Standard estimation command syntax

nestreg [, options ] : command_name depvar (varlist) [(varlist) ...] [if] [in] [weight] [, command_options]

Survey estimation command syntax

nestreg [, options] : svy [vcetype] [, svy_options] : command_name depvar (varlist) [(varlist) ...] [if] [in] [, command_options]

options Description ------------------------------------------------------------------------- Reporting waldtable report Wald test results; the default lrtable report likelihood-ratio test results quietly suppress any output from command_name store(stub) store nested estimation results in _est_stub# ------------------------------------------------------------------------- by is allowed; see prefix. Weights are allowed if command_name allows them; see weight. A varlist in parentheses indicates that this list of variables is to be considered as a block. Each variable in a varlist not bound in parentheses will be treated as its own block. All postestimation commands behave as they would after command_name without the nestreg prefix; see the postestimation manual entry for command_name.


Statistics > Other > Nested model statistics


nestreg fits nested models by sequentially adding blocks of variables and then reports comparison tests between the nested models.


+-----------+ ----+ Reporting +--------------------------------------------------------

waldtable specifies that the table of Wald test results be reported. waldtable is the default.

lrtable specifies that the table of likelihood-ratio tests be reported. This option is not allowed if pweights, the vce(robust) option, or the vce(cluster clustvar) option is specified. lrtable is also not allowed with the svy prefix.

quietly suppresses the display of any output from command_name.

store(stub) specifies that each model fit by nestreg be stored under the name _est_stub#, where # is the nesting order from first to last.


Remarks are presented under the following headings:

Estimation commands Wald tests Likelihood-ratio tests Programming for nestreg

Estimation commands

nestreg removes collinear predictors and observations with missing values from the estimation sample before calling command_name.

The following Stata commands are supported by nestreg:

betareg, clogit, cloglog, glm, intreg, logistic, logit, nbreg, ologit, oprobit, poisson, probit, qreg, regress, scobit, stcox, stcrreg, stintreg, streg, and tobit

You do not supply a depvar for stcox, stcrreg, stintreg, or streg; otherwise, depvar is required. You must supply two depvars for intreg.

Wald tests

We wish to test the significance of the following predictors of birth rate: medage, medagesq, and region (already partitioned into four indicator variables, reg1, reg2, reg3, and reg4).

. webuse census4 . nestreg: regress brate (medage) (medagesq) (reg2-reg4)

This single call to nestreg ran regress three times, adding a block of predictors to the model for each run as in

. regress brate medage . regress brate medage medagesq . regress brate medage medagesq reg2-reg4

nestreg collected the F statistic for the corresponding block of predictors and the model R-squared statistic from each model fit.

The F statistic for the first block, 164.72, is for a test of the joint significance of the first block of variables; it is simply the F statistic from the regression of brate on medage. The F statistic for the second block, 35.25, is for a test of the joint significance of the second block of variables in a regression of both the first and second blocks of variables. In our example it is an F test of medagesq in the regression of brate on medage and medagesq. Similarly, the third block's F statistic of 8.85 corresponds to a joint test of reg2, reg3, and reg4 in the final regression.

Likelihood-ratio tests

The nestreg command provides a simple syntax for performing likelihood-ratio tests for nested model specifications; also see [R] lrtest. Using the data from the first example of [R] lrtest, we wish to jointly test the significance of the following predictors of low birthweight: age, lwt, ptl, and ht.

. webuse lbw . xi: nestreg, lr: logistic low (i.race smoke ui) (age lwt ptl ht)

The estimation results from the full model are left in e(), so we can later use estat and other postestimation commands.

. estat gof

Programming for nestreg

If you want your community-contributed command (command_name) to work with nestreg, it must follow standard Stata syntax and allow the if qualifier. Furthermore, command_name must have sw or swml as a program property; see [P] program properties. If command_name has swml as a property, command_name must store the log-likelihood value in e(ll) and the model degrees of freedom in e(df_m).

Stored results

nestreg stores the following in r():

Matrices r(wald) matrix corresponding to the Wald table r(lr) matrix corresponding to the likelihood-ratio table

© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index