楼主: kaoyanone
7632 6

[其他] 如何做以下检验 [推广有奖]

  • 0关注
  • 4粉丝

已卖:1320份资源

讲师

6%

还不是VIP/贵宾

-

威望
0
论坛币
652 个
通用积分
65.7393
学术水平
23 点
热心指数
40 点
信用等级
16 点
经验
3146 点
帖子
113
精华
0
在线时间
502 小时
注册时间
2006-1-4
最后登录
2016-4-16

楼主
kaoyanone 发表于 2012-2-6 11:14:31 |AI写论文

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

求职就业群
赵安豆老师微信:zhaoandou666

经管之家联合CDA

送您一个全额奖学金名额~ !

感谢您参与论坛问题回答

经管之家送您两个论坛币!

+2 论坛币
我做了如下的回归:

y=beta* X1+ gamma* X2+ epsilon

请问如何做t-test检验一下假设:

H0:    beta+k*gamma>0

谢谢!
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

关键词:T-test gamma beta test ETA 如何

沙发
蓝色 发表于 2012-2-7 13:11:57
就直接检验等式就可以了

藤椅
kaoyanone 发表于 2012-2-9 09:44:06
蓝色 发表于 2012-2-7 13:11
就直接检验等式就可以了
高手,能不能细一点,还是看不懂啊。我估计出了系数以后怎么用stata操作呢?谢谢啦!

板凳
蓝色 发表于 2012-2-9 11:04:40

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.


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

    Online:  [R] lincom, [R] lrtest, [R] nlcom, [R] test

报纸
蓝色 发表于 2012-2-9 11:05:05

help nlcom                                                                                                     dialog:  nlcom
-----------------------------------------------------------------------------------------------------------------------------

Title

    [R] nlcom -- Nonlinear combinations of estimators


Syntax

    Nonlinear combination of estimators -- one expression

        nlcom [name:]exp [, options]


    Nonlinear combinations of estimators -- more than one expression

        nlcom ([name:]exp) [([name:]exp) ...] [, options]


    The second syntax means that if more than one expression is specified, each must be surrounded by parentheses.  exp is
        any function of the parameter estimates that is valid syntax for testnl. However, exp may not contain an equal sign
        or a comma.  The optional name is any valid Stata name and labels the transformation.

    options       description
    -----------------------------------------------------------------------------------------------------------------------
      level(#)    set confidence level; default is level(95)
      iterate(#)  maximum number of iterations
      post        post estimation results
    + noheader    suppress output header
    -----------------------------------------------------------------------------------------------------------------------
    + noheader does not appear in the dialog box.


Description

    nlcom computes point estimates, standard errors, test statistics, significance levels, and confidence intervals for
    (possibly) nonlinear combinations of parameter estimates after any Stata estimation command.  Results are displayed in
    the usual table format used for displaying estimation results.  Calculations are based on the "delta method", an
    approximation appropriate in large samples.

    nlcom can be used with svy estimation results; see [SVY] svy postestimation.


Options

    level(#) specifies the confidence level, as a percentage, for confidence intervals.  The default is level(95) or as set
        by set level.

    iterate(#) specifies the maximum number of iterations used to find the optimal step size in calculating numerical
        derivatives of the transformations with respect to the original parameters.  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.

    post causes nlcom to behave like a Stata estimation (eclass) command.  When post is specified, nlcom will post the
        vector of transformed estimators and its estimated variance-covariance matrix to e(). This option, in essence,
        makes the transformation permanent.  Thus you could, after posting, treat the transformed estimation results in the
        same way as you would treat results from other Stata estimation commands.  For example, after posting, you could
        redisplay the results by typing nlcom without any arguments, or use test to perform simultaneous tests of
        hypotheses on linear combinations of the transformed estimators.

        Specifying post clears out the previous estimation results, which can be recovered only by refitting the original
        model or by storing the estimation results before running nlcom and then restoring them; see [R] estimates store.

    The following option is available with nlcom but is not shown in the dialog box:

    noheader suppresses the output header.


Comparison with lincom

    nlcom is a generalization of lincom that allows the estimation of nonlinear transformations of model parameters.  In
    cases where you are estimating one transformation and that transformation is linear, use lincom; it is faster.
    However, when estimating more than one linear transformation or combinations of linear and nonlinear transformations,
    using nlcom has the added benefit that you can obtain the variance-covariance matrix (which is saved in r(V)) of the
    joint transformation.  lincom does not allow the simultaneous estimation of multiple linear combinations.


Remark on the manipulability of nonlinear Wald tests

    In contrast to likelihood-ratio tests, different -- mathematically equivalent -- formulations of a hypothesis may lead
    to different results for a nonlinear Wald test (lack of "invariance"). For instance, the two hypotheses

        H0: coefficient = 0

        H0: exp(coefficient) - 1 = 0

    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.


Examples

    -------------------------------------------------------------------------------------------------------------------------
    Setup
        . webuse regress

    Fit linear regression model
        . regress y x1 x2 x3

    Estimate the product of the coefficients on x2 and x3
        . nlcom _b[x2]*_b[x3]

    Estimate the ratios of the coefficients on x1 and x2 and on x2 and x3 jointly
        . nlcom (ratio1: _b[x1]/_b[x2]) (ratio2: _b[x2]/_b[x3]), post

    Test whether the two ratios from above are equal
        . test _b[ratio1] = _b[ratio2]

    -------------------------------------------------------------------------------------------------------------------------
    Setup
        . webuse sysdsn3

    Fit maximum-likelihood multinomial logit model
        . mlogit insure age male nonwhite site2 site3

    Estimate the ratio of the coefficients on the male dummy in the Prepaid and Uninsure equations
        . nlcom [Prepaid]_b[male] / [Uninsure]_b[male]
    -------------------------------------------------------------------------------------------------------------------------


Saved results

    nlcom saves the following in r():

    Scalars        
      r(N)                number of observations
      r(df_r)             residual degrees of freedom

    Matrices      
      r(b)                vector of transformed coefficients
      r(V)                estimated variance-covariance matrix of the transformed coefficients

    If post is specified, nlcom also saves the following in e():

    Scalars        
      e(N)                number of observations
      e(df_r)             residual degrees of freedom
      e(N_strata)         number of strata L, if used after svy
      e(N_psu)            number of sampled PSUs n, if used after svy

    Macros         
      e(cmd)              nlcom
      e(predict)          program used to implement predict
      e(properties)       b V

    Matrices      
      e(b)                vector of transformed coefficients
      e(V)                estimated variance-covariance matrix of the transformed coefficients
      e(V_srs)            simple-random-sampling-without-replacement (co)variance hat V_srswor, if svy
      e(V_srswr)          simple-random-sampling-with-replacement (co)variance hat V_srswr, if svy and fpc()
      e(V_msp)            misspecification (co)variance hat V_msp, if svy and available

    Functions      
      e(sample)           marks estimation sample


Also see

    Manual:  [R] nlcom

    Online:  [R] lincom, [R] predictnl, [R] test, [R] testnl

地板
蓝色 发表于 2012-2-9 11:05:23

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

7
kaoyanone 发表于 2012-2-9 12:20:17
蓝色 发表于 2012-2-9 11:05
help test, help testparm                                                                           ...
真是太谢谢啦!

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注jltj
拉您入交流群
GMT+8, 2026-1-1 03:43