|
help test, help testparm dialogs: test testparm
-----------------------------------------------------------------------------------------------------------------------------
Title
[R] test -- Test linear hypotheses after estimation
Syntax
Basic syntax (see [R] anova postestimation for test after anova;
see [MV] manova postestimation for test after manova)
test coeflist (Syntax 1)
test exp=exp[=...] (Syntax 2)
test [eqno] [: varlist] (Syntax 3)
test [eqno=eqno[=...]] [: varlist] (Syntax 4)
testparm varlist [, equal equation(eqno)]
Full syntax
test (spec) [(spec) ...] [, test_options]
test_options description
-----------------------------------------------------------------------------------------------------------------------
Options
mtest[(opt)] test each condition separately
coef report estimated constrained coefficients
accumulate test hypothesis jointly with previously tested hypotheses
notest suppress the output
common test only variables common to all the equations
constant include the constant in coefficients to be tested
nosvyadjust carry out the Wald test as W/k ~ F(k,d); for use with svy estimation commands
minimum perform test with the constant, drop terms until the test becomes nonsingular, and test without
the constant on the remaining terms; highly technical
+ matvlc(matname) save the variance-covariance matrix; programmer's option
-----------------------------------------------------------------------------------------------------------------------
+ matvlc(matname) does not appear in the dialog box.
varlist and varname may contain time-series operators; see tsvarlist.
Syntax 1 tests that coefficients are 0.
Syntax 2 tests that linear expressions are equal.
Syntax 3 tests that coefficients in eqno are 0.
Syntax 4 tests equality of coefficients between equations.
spec is one of
coeflist
exp=exp[=...]}
[eqno][: varlist]
[eqno1=eqno2[=...]][: varlist]
coeflist is
varlist
[eqno]varname [[eqno]varname...]
[eqno]_b[varname] [[eqno]_b[varname]...]
exp is a linear expression containing
varname
_b[varname]
[eqno]varname
[eqno]_b[varname]
eqno is
##
name
Distinguish between [], which are to be typed, and [], which indicate optional arguments.
Although not shown in the syntax diagram, parentheses around spec are required only with multiple specifications.
Also, the diagram does not show that test may be called without arguments to redisplay the results from the last test.
Description
test performs Wald tests for simple and composite linear hypotheses about the parameters of the most recently fitted
model.
test supports svy estimators, carrying out an adjusted Wald test by default in such cases. test can be used with svy
estimation results, see [SVY] svy postestimation.
testparm provides a useful alternative to test that permits varlist rather than a list of coefficients (which is often
nothing more than a list of variables), allowing the use of standard Stata notation, including '-' and '*', which are
given the expression interpretation by test.
test and testparm perform Wald tests. For likelihood-ratio tests, see [R] lrtest. For Wald-type tests of nonlinear
hypotheses, see [R] testnl. To display estimates for one-dimensional linear or nonlinear expressions of coefficients,
see [R] lincom and [R] nlcom.
See [R] anova postestimation for test after anova.
See [MV] manova postestimation for test after manova.
Options for testparm
equal tests that the variables appearing in varlist, which also appear in the previously fitted model, are equal to
each other rather than jointly equal to zero.
equation(eqno) is relevant only for multiple-equation models such as mvreg, mlogit, and heckman. It specifies the
equation for which the all-zero or all-equal hypothesis is tested. equation(#1) specifies that the test be
conducted regarding the first equation #1. equation(price) specifies that the test concern the equation named
price.
Options for test
+---------+
----+ 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).
coef specifies that the estimated constrained coefficients be displayed.
accumulate allows a hypothesis to be tested jointly with the previously tested hypotheses.
notest suppresses the output. This option is useful when you are interested only in the joint test of several
hypotheses, specified in a subsequent call of test, accumulate.
common specifies that when you use the [eqno1=eqno2[=...]] form of spec, the variables common to the equations eqno1,
eqno2, etc., be tested. The default action is to complain if the equations have variables not in common.
constant specifies that _cons be included in the list of coefficients to be tested when using the [eqno1=eqno2[=...]]
or [eqno] forms of spec. The default is not to include _cons.
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.
minimum is a highly technical option. It first performs the test with the constant added. If this test is singular,
coefficients are dropped until the test becomes nonsingular. Then the test without the constant is performed with
the remaining terms.
The following option is available with test but is not shown in the dialog box:
matvlc(matname), a programmer's option, saves the variance-covariance matrix of the linear combinations involved in the
suite of tests. For the test of the linear constraints L*b = c, matname contains L*V*L', where V is the estimated
variance-covariance matrix of b.
Examples after single-equation estimation except anova
Setup
. webuse census4
. regress brate medage medagesq reg2-reg4
Test coefficient on reg3 is 0
. test reg3=0
Shorthand for the previous test command
. test reg3
Test coefficient on reg2=coefficient on reg4
. test reg2=reg4
Stata will perform the algebra, and then do the test
. test 2*(reg2-3*(reg3-reg4))=reg3+reg2+6*(reg4-reg3)
Test that coefficients on reg2 and reg3 are jointly equal to 0
. test (reg2=0) (reg3=0)
The following two commands are equivalent to the previous test command
. test reg2 = 0
. test reg3 = 0, accumulate
Test that the coefficients on reg2, reg3, and reg4 are all 0; testparm understands a varlist
. testparm reg2-reg4
In the above example, you may substitute any single-equation estimation command (such as clogit, logistic, logit, and
ologit) for regress.
Examples after anova
Setup
. webuse census4
. anova brate medage medagesq reg2 reg3 reg4, continuous(medage medagesq)
Test coefficient on reg3 is 0
. test _coef[reg3[1]]=0
Shorthand for the previous test command
. test reg3
Test coefficient on reg2=coefficient on reg4
. test _coef[reg2[1]]=_coef[reg4[1]]
Test that the coefficients on reg2 and reg3 are jointly equal to 0
. test _coef[reg2[1]]=0, notest
. test _coef[reg3[1]]=0, accumulate
Test that the coefficients on reg2, reg3, and reg4 are all 0; you cannot use testparm after anova
. test _coef[reg2[1]]=0, notest
. test _coef[reg3[1]]=0, accumulate notest
. test _coef[reg4[1]]=0, accumulate
Examples after multiple-equation estimation commands
Setup
. sysuse auto
. sureg (price foreign mpg displ) (weight foreign length)
Test significance of foreign in the price equation
. test [price]foreign
Test that foreign is jointly 0 in both equations
. test [price]foreign [weight]foreign
Shorthand for the previous test command
. test foreign
Test a cross-equation constraint
. test [price]foreign = [weight]foreign
Alternative syntax for the previous test
. test [price=weight]: foreign
Test all coefficients except the intercept in an equation
. test [price]
Test that foreign and displ are jointly 0 in the price equation
. test [price]: foreign displ
Test that the coefficients on variables that are common to both equations are jointly 0
. test [price=weight], common
Simultaneous test of multiple constraints
. test ([price]: foreign) ([weight]: foreign)
Saved results
test and testparm save the following in r():
Scalars
r(p) two-sided p-value
r(F) F statistic
r(df) test constraints degrees of freedom
r(df_r) residual degrees of freedom
r(dropped_i) index of ith constraint dropped
r(chi2) chi-squared
r(ss) sum of squares (test)
r(rss) residual sum of squares
r(drop) 1 if constraints were dropped, 0 otherwise
Macros
r(mtmethod) method of adjustment for multiple testing
r(ss) and r(rss) are defined only when test is used for testing effects after anova.
Also see
Manual: [R] test
Online: [R] anova, [R] anova postestimation, [R] lincom, [R] lrtest, [R] nlcom, [R] testnl
|