Announcement

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

  • "Variable not found" upon attempting to test, after running regression model.

    Hello, I'm using Stata 13 and working with complex survey data (DHS 2013). I'm having problems testing my predictor variables after running my model:

    Please see document attached for the output/response.

    Same thing happens even when I attempt to test the predictors individually. (NB: I tested the outcome variables successfully though).

    Thank you for your help.
    Som
    Attached Files
    Last edited by Som Nwegbu; 28 Feb 2017, 08:45.

  • #2
    Som:
    we do not see anything about what you typed and what Stata gave you back. Hence, I find impossible to reply.
    Kind regards,
    Carlo
    (Stata 19.0)

    Comment


    • #3
      Thank you. I just noticed the error myself and amended the post.

      Comment


      • #4
        Som:
        despite your laudable effort to amend your previous post, most of us do not open/use .docx and other common file formats.
        As per FAQ the best way to post what you typed and what Stata gave you back is via CODE delimiters.
        Besides, you can post an excerpt/example of your dataset via -dataex- from SSC.
        Kind regards,
        Carlo
        (Stata 19.0)

        Comment


        • #5
          My sincere apologies, and thank you for setting me right. Here is the output with the code delimiters. I hope I got it right this time.

          Code:
          . mvreg anch inch dmchil limchild = i.exipv i.agemarr4 i.rel i.weduc i.Wempow i.wipv i.polyg i.chcomm
          
          Equation Obs Parms RMSE "R-sq" F P
          
          anch 16114 14 .4250494 0.2402 391.518 0.0000
          inch 16114 14 .4204062 0.2882 501.4525 0.0000
          dmchil 16114 14 .3526811 0.0900 122.5547 0.0000
          limchild 16114 14 .4560623 0.1265 179.3537 0.0000
          
          
          Coef. Std. Err. t P>t [95% Conf. Interval]
          
          anch
          exipv
          Yes .0424252 .0092808 4.57 0.000 .0242339 .0606165
          
          agemarr4
          15-17 years -.0771878 .0094442 -8.17 0.000 -.0956996 -.058676
          18-21 years -.1135442 .0105576 -10.75 0.000 -.1342383 -.0928501
          22 years or older -.1770452 .011913 -14.86 0.000 -.200396 -.1536943
          
          rel
          catholic .115711 .0136041 8.51 0.000 .0890455 .1423765
          other christian .0805618 .0092663 8.69 0.000 .0623987 .0987248
          
          weduc
          primary .0067942 .0102279 0.66 0.507 -.0132535 .026842
          secondary -.1022443 .0103025 -9.92 0.000 -.1224384 -.0820503
          higher than secondary -.0982048 .0153291 -6.41 0.000 -.1282516 -.068158
          
          Wempow
          Empowered .0284312 .0075755 3.75 0.000 .0135825 .04328
          
          wipv
          yes .0093565 .0116604 0.80 0.422 -.0134991 .0322122
          
          polyg
          Yes .0916139 .0083539 10.97 0.000 .0752393 .1079884
          
          chcomm
          Yes .7959637 .0124833 63.76 0.000 .7714949 .8204324
          _cons .3550245 .0141289 25.13 0.000 .3273303 .3827187
          
          inch
          exipv
          Yes -.0019619 .0091794 -0.21 0.831 -.0199545 .0160306
          
          agemarr4
          15-17 years -.0303042 .0093411 -3.24 0.001 -.0486137 -.0119946
          18-21 years -.0983254 .0104423 -9.42 0.000 -.1187934 -.0778574
          22 years or older -.18858 .0117829 -16.00 0.000 -.2116757 -.1654842
          
          rel
          catholic -.1310468 .0134554 -9.74 0.000 -.157421 -.1046727
          other christian -.1755753 .0091651 -19.16 0.000 -.1935399 -.1576107
          
          weduc
          primary -.104613 .0101161 -10.34 0.000 -.1244417 -.0847842
          secondary -.2921949 .0101899 -28.67 0.000 -.3121684 -.2722215
          higher than secondary -.3748884 .0151617 -24.73 0.000 -.404607 -.3451699
          
          Wempow
          Empowered -.0774337 .0074927 -10.33 0.000 -.0921202 -.0627471
          
          wipv
          yes .0009854 .011533 0.09 0.932 -.0216205 .0235914
          
          polyg
          Yes .0382797 .0082626 4.63 0.000 .022084 .0544754
          
          chcomm
          Yes .0463013 .012347 3.75 0.000 .0220998 .0705027
          _cons 1.877182 .0139746 134.33 0.000 1.849791 1.904574
          
          dmchil
          exipv
          Yes -.0452851 .0077006 -5.88 0.000 -.0603792 -.030191
          
          agemarr4
          15-17 years .0020027 .0078363 0.26 0.798 -.0133573 .0173627
          18-21 years -.0158285 .0087601 -1.81 0.071 -.0329993 .0013422
          22 years or older .0365245 .0098847 3.70 0.000 .0171493 .0558997
          
          rel
          catholic -.1557431 .0112878 -13.80 0.000 -.1778686 -.1336177
          other christian -.1505418 .0076886 -19.58 0.000 -.1656124 -.1354712
          
          weduc
          primary -.0786239 .0084865 -9.26 0.000 -.0952584 -.0619895
          secondary -.0166112 .0085484 -1.94 0.052 -.033367 .0001446
          higher than secondary -.0709052 .0127192 -5.57 0.000 -.0958363 -.0459741
          
          Wempow
          Empowered -.0705726 .0062857 -11.23 0.000 -.0828933 -.058252
          
          wipv
          yes .0081457 .0096751 0.84 0.400 -.0108186 .02711
          
          polyg
          Yes -.0517344 .0069316 -7.46 0.000 -.0653211 -.0381478
          
          chcomm
          Yes -.0861196 .0103579 -8.31 0.000 -.1064223 -.0658168
          _cons 1.050703 .0117233 89.62 0.000 1.027724 1.073682
          
          limchild
          exipv
          Yes .0586822 .0099579 5.89 0.000 .0391636 .0782008
          
          agemarr4
          15-17 years .0124821 .0101333 1.23 0.218 -.0073803 .0323446
          18-21 years .0500045 .0113279 4.41 0.000 .0278005 .0722084
          22 years or older -.0061054 .0127822 -0.48 0.633 -.03116 .0189492
          
          rel
          catholic .1472927 .0145966 10.09 0.000 .1186816 .1759037
          other christian .1487904 .0099424 14.97 0.000 .1293022 .1682786
          
          weduc
          primary .1180335 .0109741 10.76 0.000 .096523 .1395439
          secondary .156371 .0110542 14.15 0.000 .1347035 .1780384
          higher than secondary .2093811 .0164476 12.73 0.000 .177142 .2416202
          
          Wempow
          Empowered .09369 .0081282 11.53 0.000 .0777579 .1096222
          
          wipv
          yes .0281382 .0125112 2.25 0.025 .0036149 .0526614
          
          polyg
          Yes .0238543 .0089634 2.66 0.008 .006285 .0414236
          
          chcomm
          Yes .1778668 .0133942 13.28 0.000 .1516128 .2041209
          _cons .002826 .0151598 0.19 0.852 -.0268888 .0325409
          
          
          . test exipv agemarr4 rel weduc Wempow wipv polyg chcomm
          exipv not found
          r(111);
          
          end of do-file
          
          r(111);
          Som
          PS: I want to follow the guidelines for posting, however, I'm struggling with making the formatting readable. This was my reason for posting it as a word document initially (the formatting was perfect that way). Oh well...I hope it makes sense.
          Last edited by sladmin; 28 Feb 2017, 10:25. Reason: fix [CODE] [/CODE] delimiters

          Comment


          • #6
            Som:
            unfortunately it is still the same situation reported in #2. Sorry for this.
            Kind regards,
            Carlo
            (Stata 19.0)

            Comment


            • #7
              Thank you for trying Carlo. I appreciate the effort.

              Comment


              • #8
                Som:
                the output can be improved but is readable now.
                What if you replace -test- with -testparm-?
                Kind regards,
                Carlo
                (Stata 19.0)

                Comment


                • #9
                  You might try running mvreg,coefl after your mvreg. This will tell you exactly how Stata refers to the parameters. I don't use mvreg, but it is possible that you need both a variable and a dependent variable identifier to specify the right parameter to test.


                  Comment


                  • #10
                    Sorry to come late to the party. Phil Bromiley has hit the nail on the head here. When you use factor-variable notation in your regression command (which is almost always a good idea!) you have to use the appropriate corresponding notation in your -test-/-testparm- commands. There is nothing about this that is specific to -mvreg-. Here's a simple example:

                    Code:
                    . sysuse auto, clear
                    (1978 Automobile Data)
                    
                    . regress price mpg i.foreign i.rep78
                    
                          Source |       SS           df       MS      Number of obs   =        69
                    -------------+----------------------------------   F(6, 62)        =      3.94
                           Model |   159087839         6  26514639.9   Prob > F        =    0.0021
                        Residual |   417709119        62  6737243.86   R-squared       =    0.2758
                    -------------+----------------------------------   Adj R-squared   =    0.2057
                           Total |   576796959        68  8482308.22   Root MSE        =    2595.6
                    
                    ------------------------------------------------------------------------------
                           price |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
                    -------------+----------------------------------------------------------------
                             mpg |  -299.6068   63.34525    -4.73   0.000    -426.2322   -172.9815
                                 |
                         foreign |
                        Foreign  |   1102.334   901.7772     1.22   0.226    -700.2928    2904.961
                                 |
                           rep78 |
                              2  |   841.3622   2055.452     0.41   0.684    -3267.428    4950.153
                              3  |   1285.116   1901.486     0.68   0.502    -2515.901    5086.132
                              4  |   1155.571   1984.561     0.58   0.562     -2811.51    5122.652
                              5  |   2353.179   2130.577     1.10   0.274    -1905.784    6612.142
                                 |
                           _cons |   10856.24   2266.757     4.79   0.000      6325.06    15387.43
                    ------------------------------------------------------------------------------
                    
                    . 
                    . capture noisily test foreign
                    foreign not found
                    
                    . 
                    . test 1.foreign
                    
                     ( 1)  1.foreign = 0
                    
                           F(  1,    62) =    1.49
                                Prob > F =    0.2262
                    
                    . 
                    . capture noisily testparm rep78
                    no such variables;
                    the specified varlist does not identify any testable coefficients
                    
                    . 
                    . testparm i.rep78
                    
                     ( 1)  2.rep78 = 0
                     ( 2)  3.rep78 = 0
                     ( 3)  4.rep78 = 0
                     ( 4)  5.rep78 = 0
                    
                           F(  4,    62) =    0.49
                                Prob > F =    0.7465
                    After you do this enough, you start to remember what the relevant notation is. Until then, as Phil Bromiley suggest, run the command again with the -coeflegend- option and Stata will show you exactly what to call things.

                    Comment


                    • #11
                      Thank you all for your input. I will try out all your suggestions and see where it takes me. Once again, thank you

                      Comment


                      • #12
                        It worked! -testparm- worked. Thanks again

                        Comment

                        Working...
                        X