Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • applying t-test for descriptive statistics.

    Hi all,

    I'm having a problem in deciding how to perform a t-test on my descriptive statistics. I'm trying to find the motivations of Chinese infrastructure investment in three different regions Africa, Europe and One belt one road. Descriptive statistics should be presented for all countries and these regions separately but I'm confused how to do that? do I perform a one-sample, two-sample or paired t-test?

    Below is the data extract of all countries combined where lnofdi is natural log of overseas infrastructure investment, lngdp is natural log of country gap and ln res is the natural log of natural resource exports.

    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input str72 country int year float(lnofdi lngdp lnres)
    "Afghanistan" 2005         0  22.55985          .
    "Afghanistan" 2006         0  22.67737          .
    "Afghanistan" 2007         0  23.01011          .
    "Afghanistan" 2008         0 23.044725          .
    "Afghanistan" 2009         0  23.24795 -1.9806697
    "Afghanistan" 2010         0   23.4919 -1.2900953
    "Afghanistan" 2011  5.991465 23.609755 -1.1848685
    "Afghanistan" 2012         0  23.74547          .
    "Afghanistan" 2013         0 23.732124          .
    "Afghanistan" 2014         0  23.74934          .
    "Afghanistan" 2015         0 23.678986   1.507562
    "Afghanistan" 2016         0  23.69209  .11735813
    "Afghanistan" 2017  5.347107 23.758955          .
    "Algeria"     2005  6.697034 25.359915  4.5902495
    "Algeria"     2006  8.781095  25.48567  4.5913815
    "Algeria"     2007         0  25.62837   4.587998
    "Algeria"     2008  5.075174 25.864935  4.5871253
    "Algeria"     2009  8.009695 25.644785  4.5867243
    "Algeria"     2010         0 25.805956  4.5812593
    "Algeria"     2011  7.106606  26.02168  4.5793686
    "Algeria"     2012  7.901007  26.06588   4.578637
    "Algeria"     2013  7.489971 26.069206   4.573566
    "Algeria"     2014  7.229839 26.088354  4.5637636
    "Algeria"     2015  5.598422 25.834494   4.550027
    "Algeria"     2016  8.116715  25.79248   4.545886
    "Algeria"     2017         0         .          .
    "Angola"      2005  7.512071  24.06378          .
    "Angola"      2006   6.60665  24.45591          .
    "Angola"      2007         0 24.825064  4.5889764
    "Angola"      2008  8.083328   25.1562          .
    "Angola"      2009  7.265429   25.0473  4.5912113
    "Angola"      2010         0  25.13638   4.590789
    "Angola"      2011  8.089482  25.36877   4.588808
    "Angola"      2012  6.214608  25.45879  4.5925374
    "Angola"      2013  7.659172 25.550884  4.5889072
    "Angola"      2014  7.478735 25.565325   4.588818
    "Angola"      2015  6.413459  25.35431  4.5881395
    "Angola"      2016  8.104704 25.280685          .
    "Angola"      2017  8.166216  25.54523          .
    "Azerbaijan"  2005         0  23.30694  4.3587813
    "Azerbaijan"  2006         0  23.76698  4.4535623
    "Azerbaijan"  2007  5.347107   24.2213  4.4208193
    "Azerbaijan"  2008  6.086775  24.61207  4.5785284
    "Azerbaijan"  2009         0  24.51406   4.533747
    "Azerbaijan"  2010         0  24.69172   4.549909
    "Azerbaijan"  2011 4.6051702  24.91219  4.5532537
    "Azerbaijan"  2012         0 24.967236  4.5427794
    "Azerbaijan"  2013         0  25.02955  4.5376697
    "Azerbaijan"  2014         0 25.044006  4.5342174
    "Azerbaijan"  2015         0  24.69496  4.4771953
    "Azerbaijan"  2016         0  24.35736   4.490126
    "Azerbaijan"  2017         0  24.43067  4.5163217
    "Bahrain"     2005         0   23.4939  4.5367546
    "Bahrain"     2006         0  23.64131  4.5476346
    "Bahrain"     2007         0  23.80196  4.5177712
    "Bahrain"     2008         0  23.97018   4.456026
    "Bahrain"     2009         0  23.85607   4.430391
    "Bahrain"     2010         0 23.970274  4.5266333
    "Bahrain"     2011         0  24.08283  4.5357018
    "Bahrain"     2012         0 24.149134  4.4454975
    "Bahrain"     2013         0  24.20572   4.348288
    "Bahrain"     2014         0 24.231453   4.405266
    "Bahrain"     2015         0 24.161304  4.3517857
    "Bahrain"     2016         0  24.19376  4.3542657
    "Bahrain"     2017         0  24.28735          .
    "Bangladesh"  2005         0  24.96377  -.2544695
    "Bangladesh"  2006         0 24.997416  .09207157
    "Bangladesh"  2007         0  25.10043   .7178987
    "Bangladesh"  2008         0  25.24104   .5525484
    "Bangladesh"  2009  5.135798 25.352915   .7216684
    "Bangladesh"  2010  6.633318  25.47062    .848006
    "Bangladesh"  2011  6.672033  25.58027    .470242
    "Bangladesh"  2012  6.536692  25.61629    .739724
    "Bangladesh"  2013   6.64639 25.733835   .3717198
    "Bangladesh"  2014  7.828038  25.87589          .
    "Bangladesh"  2015  8.368693  25.99667  -.3096612
    "Bangladesh"  2016  9.180912 26.123304          .
    "Bangladesh"  2017  8.306472  26.24362          .
    "Belarus"     2005         0  24.13136   3.559921
    "Belarus"     2006         0  24.33295   3.655087
    "Belarus"     2007  6.429719 24.536074   3.571639
    "Belarus"     2008  5.799093 24.830256  3.6226616
    "Belarus"     2009         0  24.61935   3.633932
    "Belarus"     2010  6.887553  24.77021   3.341227
    "Belarus"     2011  7.286192 24.846485   3.590348
    "Belarus"     2012  5.991465  24.90814  3.6442685
    "Belarus"     2013         0  25.04777   3.497674
    "Belarus"     2014  5.828946 25.090355    3.52727
    "Belarus"     2015  6.684612 24.756704   3.395893
    "Belarus"     2016  6.745236  24.58867   3.079409
    "Belarus"     2017         0  24.72041          .
    "Belgium"     2005         0 26.682636  2.2639782
    "Belgium"     2006         0 26.738966   2.435225
    "Belgium"     2007         0 26.879866  2.3704205
    "Belgium"     2008         0  26.97445    2.52924
    "Belgium"     2009         0  26.90649  2.3230798
    "Belgium"     2010         0 26.904417   2.522069
    "Belgium"     2011         0  26.99048  2.6771014
    "Belgium"     2012  5.560682 26.933634   2.716798
    "Belgium"     2013         0  26.97887  2.7679825
    end
    format %ty year

  • #2
    Alina:
    descriptive statistics are something pretty different from -ttest-, that is in fact an inferential procedure.
    That said, since you have -panelid-, -timevar- and predictors you should consider -xtreg- or pooled OLS, as you can see from the following toy-example:
    Code:
    . encode country, g(num_country)
    
    . xtset num_country year
           panel variable:  num_country (unbalanced)
            time variable:  year, 2005 to 2017
                    delta:  1 year
    
    . xtreg lnres lngdp lnofdi i.year,re
    
    Random-effects GLS regression                   Number of obs     =         81
    Group variable: num_country                     Number of groups  =          8
    
    R-sq:                                           Obs per group:
         within  = 0.0052                                         min =          5
         between = 0.4145                                         avg =       10.1
         overall = 0.0531                                         max =         13
    
                                                    Wald chi2(14)     =       3.70
    corr(u_i, X)   = 0 (assumed)                    Prob > chi2       =     0.9970
    
    ------------------------------------------------------------------------------
           lnres |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
           lngdp |  -.1096797   .2307696    -0.48   0.635    -.5619798    .3426203
          lnofdi |   .0330184   .0684711     0.48   0.630    -.1011825    .1672193
                 |
            year |
           2006  |   .1272218   1.078335     0.12   0.906    -1.986276     2.24072
           2007  |   .3823702   1.041355     0.37   0.713    -1.658647    2.423388
           2008  |     .22031   1.088777     0.20   0.840    -1.913654    2.354274
           2009  |  -.3416826   1.012921    -0.34   0.736     -2.32697    1.643605
           2010  |  -.1951007   1.011573    -0.19   0.847    -2.177747    1.787546
           2011  |  -.2697862   1.041118    -0.26   0.796     -2.31034    1.770767
           2012  |   .4039275   1.070549     0.38   0.706     -1.69431    2.502165
           2013  |   .3790598   1.059497     0.36   0.721    -1.697516    2.455636
           2014  |   1.109276   1.149802     0.96   0.335    -1.144294    3.362847
           2015  |  -.0141918   1.054324    -0.01   0.989    -2.080629    2.052245
           2016  |   .0658223   1.138559     0.06   0.954    -2.165711    2.297356
           2017  |   1.352546   2.017574     0.67   0.503    -2.601825    5.306918
                 |
           _cons |   5.843325   5.721976     1.02   0.307    -5.371543    17.05819
    -------------+----------------------------------------------------------------
    
    . xttest0
    
    Breusch and Pagan Lagrangian multiplier test for random effects
    
            lnres[num_country,t] = Xb + u[num_country] + e[num_country,t]
    
            Estimated results:
                             |       Var     sd = sqrt(Var)
                    ---------+-----------------------------
                       lnres |   3.035114       1.742158
                           e |   .1561374       .3951422
                           u |          0              0
    
            Test:   Var(u) = 0
                                 chibar2(01) =     0.00
                              Prob > chibar2 =   1.0000
    
    *The outcome of -xttest0 tells that your panel data can be better analyzed via a pooled OLS*
    
    . reg lnres lngdp lnofdi i.year,vce(cluster num_country)
    
    Linear regression                               Number of obs     =         81
                                                    F(6, 7)           =          .
                                                    Prob > F          =          .
                                                    R-squared         =     0.0531
                                                    Root MSE          =     1.8664
    
                                (Std. Err. adjusted for 8 clusters in num_country)
    ------------------------------------------------------------------------------
                 |               Robust
           lnres |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
           lngdp |  -.1096797   .5437072    -0.20   0.846    -1.395343    1.175983
          lnofdi |   .0330184   .0884176     0.37   0.720     -.176056    .2420928
                 |
            year |
           2006  |   .1272218   .1455893     0.87   0.411    -.2170423    .4714859
           2007  |   .3823702   .3912203     0.98   0.361    -.5427189    1.307459
           2008  |     .22031   .4724056     0.47   0.655    -.8967518    1.337372
           2009  |  -.3416826   .9973936    -0.34   0.742    -2.700144    2.016778
           2010  |  -.1951007   .9579981    -0.20   0.844    -2.460406    2.070205
           2011  |  -.2697862   1.148421    -0.23   0.821     -2.98537    2.445798
           2012  |   .4039275   .7330617     0.55   0.599    -1.329488    2.137343
           2013  |   .3790598   .6447926     0.59   0.575    -1.145632    1.903752
           2014  |   1.109276   1.037289     1.07   0.320    -1.343523    3.562075
           2015  |  -.0141918   .5886858    -0.02   0.981    -1.406212    1.377829
           2016  |   .0658223   1.039291     0.06   0.951     -2.39171    2.523354
           2017  |   1.352546   .7658159     1.77   0.121    -.4583205    3.163413
                 |
           _cons |   5.843325   13.34672     0.44   0.675    -25.71665     37.4033
    ------------------------------------------------------------------------------
    
    .
    . testparm(i.year)
    
     ( 1)  2006.year = 0
     ( 2)  2007.year = 0
     ( 3)  2008.year = 0
     ( 4)  2009.year = 0
     ( 5)  2010.year = 0
     ( 6)  2011.year = 0
     ( 7)  2012.year = 0
     ( 8)  2013.year = 0
     ( 9)  2014.year = 0
     (10)  2015.year = 0
     (11)  2016.year = 0
     (12)  2017.year = 0
           Constraint 1 dropped
           Constraint 3 dropped
           Constraint 4 dropped
           Constraint 8 dropped
           Constraint 10 dropped
    
           F(  7,     7) =    2.82
                Prob > F =    0.0973
    *-testparm- tells you that years are not jointly statistically significant (this piece of information can be as informative as a statistical significant outcome)*
    Kind regards,
    Carlo
    (Stata 19.0)

    Comment


    • #3
      Dear Carlo,

      Thank you for your prompt reply. Apologies as my post does not clearly state my problem. I have applied the xtabond2 command for SystemGMM. My problem is to find out if it is possible to conduct a t test for my inferential statistics (mean standard deviation etc). I have seen some papers in which these tests are conducted and was wondering if it is possible to do with my research.

      Kind regards,

      Alina.

      Comment


      • #4
        Alina:
        sorry that I cannot be more helpful.
        Kind regards,
        Carlo
        (Stata 19.0)

        Comment


        • #5
          Dear Carlo,
          Can you please assist me on the command to run the following;
          Nearest neighbor matching
          Radius matching
          Kernel Matching

          Thanks

          Comment


          • #6
            Agbenyo:
            please do not queue your queries up under an original post which title has nothing to do with the contents of your question.
            Start a new thread, indeed.
            It is also worth highlighting that most part of the topics you're intreseted in can be accessed from help file and investigated with greater detail in Stata .pdf manual.
            Eventually, read the FAQ on how to post (more) effectively. Thanks.
            Kind regards,
            Carlo
            (Stata 19.0)

            Comment

            Working...
            X