[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: New -nlcheck- package available from SSC: check linearity assumption after model estimation

From   "Ben Jann" <>
To   statalist <>
Subject   st: New -nlcheck- package available from SSC: check linearity assumption after model estimation
Date   Thu, 16 Oct 2008 10:40:54 +0200

Thanks to Kit Baum, a new package called -nlcheck- is available from SSC.

-nlcheck- is a simple but effective diagnostic that can be used after
fitting a model to quickly check the linearity assumption for a  given
predictor. -nlcheck- categorizes the predictor into bins, refits the
model including dummy variables for the bins, and then performs a
joint Wald test for the added parameters. A significant test result
indicates that the linearity assumption is violated. Alternatively,
-nlcheck- uses linear splines for the adaptive model. Support for
discrete variables is also provided.

Optionally, -nlcheck- also displays a graph of the adjusted linear
predictions from the original model and the adaptive model, including
pointwise confidence intervals for the adaptive fit.

-nlcheck- can be used with any estimation command as long as it
supports -test- (and -adjust-), follows the standard syntax

        command varlist [if] [in] [weight] [, options ]

and stores the command as typed in e(cmdline). However, Stata 10 is required.

To install the package, type

 . ssc install nlcheck

See, e.g., Gould (1993) for a good account on modeling nonlinear
effects using dummies and linear splines. Also see, e.g., official
Stata's -fracpoly- and -mpf- as well as user commands such as -mvrs-
(Royston and Sauerbrei 2007) or -gam- (Royston and Ambler 1998) for
more sophisticated approaches to deal with nonlinear relationships.


Gould, W. (1993). sg19: Linear splines and piecewise linear functions.
Stata Technical Bulletin 15:13-17.

Royston, Patrick, and Gareth Ambler. 1998. sg79: Generalized additive
models. Stata Technical Bulletin 42:38-43.

Royston, Patrick, and Willi Sauerbrei. 2007. Multivariable modeling
with cubic regression splines: A principled approach. The Stata
Journal 7:45-70.
*   For searches and help try:

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