是testnl 那个是L 不是1
help testnl dialog: testnl
-------------------------------------------------------------------------------
Title
[R] testnl -- Test nonlinear hypotheses after estimation
Syntax
testnl exp=exp[=exp...] [, options]
testnl (exp=exp[=exp...]) [(exp=exp[=exp...]) ...] [, options]
options description
-------------------------------------------------------------------------
mtest[(opt)] test each condition separately
nosvyadjust carry out the Wald test as W/k ~ F(k,d); for use with
svy estimation commands
iterate(#) use maximum # of iterations to find the optimal step
size
-------------------------------------------------------------------------
The second syntax means that if more than one constraint is specified,
each must be surrounded by parentheses.
Menu
Statistics > Postestimation > Tests > Test nonlinear hypotheses
Description
testnl tests (linear or nonlinear) hypotheses about the estimated
parameters from the most recently fitted model.
testnl produces Wald-type tests of smooth nonlinear (or linear)
hypotheses about the estimated parameters from the most recently fitted
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
postestimation.
The format (exp1=exp2=exp3= ... ) for a simultaneous-equality hypothesis
is just a convenient shorthand for (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. testnl is the only option for
testing linear and nonlinear hypotheses simultaneously.
Options
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
mtest(noadjust).
nosvyadjust is for use with svy estimation commands. It specifies that
the Wald test be 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 total number of sampled PSUs minus the total number of
strata.
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.
Remark
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
hypotheses
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
H0.
Likelihood-ratio testing does satisfy representation invariance.
Examples
Setup
. 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
Holm's method
. testnl (_b[mpg] = 1/_b[weight]) (_b[trunk] = 1/_b[length]),
mtest(holm)
Saved results
testnl saves the following in r():
Scalars
r(df) degrees of freedom
r(df_r) residual degrees of freedom
r(chi2) chi-squared
r(p) significance
r(F) F statistic
Matrices
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.
Also see
Manual: [R] testnl
Help: [R] lincom, [R] lrtest, [R] nlcom, [R] test