[R] testnl -- Test nonlinear hypotheses after estimation
testnl exp = exp [= exp ...] [, options]
testnl (exp = exp [= exp...]) [(exp = exp [= exp ...]) ...] [,
mtest[(opt)] test each condition separately
iterate(#) use maximum # of iterations to find the optimal step
df(#) use F distribution with # denominator degrees of freedom
for the reference distribution of the test statistic
nosvyadjust carry out the Wald test as W/k ~ F(k,d); for use with
svy estimation commands when the df() option is also
df(#) and nosvyadjust do not appear in the dialog box.
The second syntax means that if more than one expression is specified,
each must be surrounded by parentheses.
exp is a possibly nonlinear expression containing
coef identifies a coefficient in the model. coef is typically a variable
name, a level indicator, an interaction indicator, or an interaction
involving continuous variables. Level indicators identify one level of a
factor variable and interaction indicators identify one combination of
levels of an interaction; see fvvarlist. coef may contain time-series
operators; see tsvarlist.
Distinguish between , which are to be typed, and , which indicate
Statistics > Postestimation
testnl tests (linear or nonlinear) hypotheses about the estimated
parameters from the most recently fit model.
testnl produces Wald-type tests of smooth nonlinear (or linear)
hypotheses about the estimated parameters from the most recently fit
model. The p-values are based on the delta method, an approximation
appropriate in large samples.
testnl can be used with svy estimation results, see [SVY] svy
The format (exp1=exp2=exp3... ) for a simultaneous-equality hypothesis is
just a convenient shorthand for a list (exp1=exp2) (exp1=exp3), etc.
testnl may also be used to test linear hypotheses. test is faster if you
want to test only linear hypotheses; see [R] test. testnl is the only
option for testing linear and nonlinear hypotheses simultaneously.
mtest[(opt)] specifies that tests be performed for each condition
separately. opt specifies the method for adjusting p-values for
multiple testing. Valid values for opt are
bonferroni Bonferroni's method
holm Holm's method
sidak Sidak's method
noadjust no adjustment is to be made
Specifying mtest without an argument is equivalent to
iterate(#) specifies the maximum number of iterations used to find the
optimal step size in the calculation of numerical derivatives of the
test expressions. By default, the maximum number of iterations is
100, but convergence is usually achieved after only a few iterations.
You should rarely have to use this option.
The following options are available with testnl but are not shown in the
df(#) specifies that the F distribution with # denominator degrees of
freedom be used for the reference distribution of the test statistic.
With survey data, # is the design degrees of freedom unless
nosvyadjust is specified.
nosvyadjust is for use with svy estimation commands when the df() option
is also specified; see [SVY] svy estimation. It specifies that the
Wald test be carried out without the default adjustment for the
design degrees of freedom. That is, the test is carried out as
W/k ~ F(k,d) rather than as (d-k+1)W/(kd) ~ F(k,d-k+1), where
k = the dimension of the test and d = the design degrees of freedom
specified in the df() option.
In contrast to likelihood-ratio tests, different -- mathematically
equivalent -- formulations of an hypothesis may lead to different results
for a nonlinear Wald test (lack of "invariance"). For instance, the two
H0: b1 = b2
H0: exp(b1) = exp(b2)
are mathematically equivalent expressions but do not yield the same test
statistic and p-value. In extreme cases, under one formulation, one would
reject H0, whereas under an equivalent formulation one would not reject
Likelihood-ratio testing does satisfy representation invariance.
. sysuse auto
. generate weightsq = weight^2
. regress price mpg trunk length weight weightsq foreign
Test one nonlinear constraint
. testnl _b[mpg] = 1/_b[weight]
Test multiple nonlinear constraints
. testnl (_b[mpg] = 1/_b[weight]) (_b[trunk] = 1/_b[length])
Test multiple nonlinear constraints separately, and adjust p-values using
. testnl (_b[mpg] = 1/_b[weight]) (_b[trunk] = 1/_b[length]),
testnl stores the following in r():
r(df) degrees of freedom
r(df_r) residual degrees of freedom
r(p) p-value for Wald test
r(F) F statistic
r(mtmethod) method specified in mtest()
r(G) derivatives of R(b) with respect to b; see Methods and
formulas in [R] testnl
r(R) R(b)-q; see Methods and formulas in [R] testnl
r(mtest) multiple test results