Announcement

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

  • Marginsplot

    Dear All,
    i am still struggling with marginsplot to portray my interaction Terms. I am running the following codes:
    // run the regression model xtgls builtlastyear rprov existingboats c.c_rprov##c.c_existingboats standalone GDPgrowth2 leisure olympic texist i.year, panel(hetero) // get plausible/interesting values to plot summarize rprov existingboats margins, dydx(rprov) at(existingboats=(30(5)75)) vsquish // get the adjusted predictions margins, at(rprov=(1 2) existingboats=(30(5)70)) vsquish // plot the predictions marginsplot, noci x(rprov) recast(line) xlabel(30(5)75) But I do get such an Output: Delta-method
    dy/dx Std. Err. z P>z [95% Conf. Interval]

    rprov
    _at
    1 . (not estimable)
    2 . (not estimable)
    3 . (not estimable)
    4 . (not estimable)
    5 . (not estimable)
    6 . (not estimable)
    7 . (not estimable)
    8 . (not estimable)
    9 . (not estimable)
    10 . (not estimable)

    What does that mean?What am I doing wrong?
    Any help would be greatly appreciated!!

  • #2
    Welcome to the Stata Forum/ Statalist.

    Please take some time to read the FAQ. There, you’ll learn how to best share command/ data/ output.

    I’m afraid to say that your post, at least to me, is barely readable.

    That said, hazarding a guess, maybe the issue is related to the bounds, when you selected - rprov - without informing it is a categorical variable.
    Best regards,

    Marcos

    Comment


    • #3
      Dear Marcos,
      many thanks for your message. So sorry I did not use the command in my previous post so that it is readable for everyone.
      That could be it, that I did not inform state that it is a categorical variable. How would I do that?
      Hopefully my do- file is better readable now!

      // run the regression model
      xtgls builtlastyear rprov existingboats c.c_rprov##c.c_existingboats standalone GDPgrowth2 leisure olympic texist i.year, panel(hetero)

      // get plausible/interesting values to plot
      summarize rprov existingboats
      margins, dydx(rprov) at(existingboats=(30(5)75)) vsquish

      // get the adjusted predictions
      margins, at(rprov=(1 2) existingboats=(30(5)70)) vsquish

      // plot the predictions
      marginsplot, noci x(rprov) recast(line) xlabel(30(5)75)

      Output:
      Delta-method dy/dx Std. Err. z P>z [95% Conf. Interval]

      rprov _at
      1 . (not estimable)
      2 . (not estimable)
      3 . (not estimable)
      4 . (not estimable)
      5 . (not estimable)
      6 . (not estimable)
      7 . (not estimable)
      8 . (not estimable)
      9 . (not estimable)
      10 . (not estimable)

      Again, any help is highly appreciated!

      Comment


      • #4
        Hard to tell exactly what your variables are, but put it into the model as i.rprov instead of rprov and see what happens!

        Comment


        • #5
          Thanks will try that. "builtlastyear" is my dependent variable, rprov is an independent variable and existingboats is the moderator.

          Comment


          • #6
            Valerie, as you may have realized, you could help us better to help you. Let me also remark that reading carefully the FAQ is a great starting point.

            This being said, I will to make a few suggestions.

            Since you didn't share data we could work on, I had to prepare an example by myself:

            Code:
            . webuse invest2
            
            . gen highstock = stock > 311 & !missing(stock)
            
            .  xtset company time
                   panel variable:  company (strongly balanced)
                    time variable:  time, 1 to 20
                            delta:  1 unit
            
            .  xtgls invest c.market##i.highstock, panels(hetero)
            
            Cross-sectional time-series FGLS regression
            
            Coefficients:  generalized least squares
            Panels:        heteroskedastic
            Correlation:   no autocorrelation
            
            Estimated covariances      =         5          Number of obs     =        100
            Estimated autocorrelations =         0          Number of groups  =          5
            Estimated coefficients     =         4          Time periods      =         20
                                                            Wald chi2(3)      =     441.11
                                                            Prob > chi2       =     0.0000
            
            ------------------------------------------------------------------------------------
                        invest |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
            -------------------+----------------------------------------------------------------
                        market |   .1044449   .0100809    10.36   0.000     .0846867    .1242031
                   1.highstock |  -52.95075   41.15659    -1.29   0.198    -133.6162    27.71469
                               |
            highstock#c.market |
                            1  |   .0903252    .017791     5.08   0.000     .0554555     .125195
                               |
                         _cons |  -17.29815   10.23841    -1.69   0.091    -37.36506    2.768759
            ------------------------------------------------------------------------------------
            
            . margins highstock, at(market=(200 (200) 6200)) vsquish
            
            Adjusted predictions                            Number of obs     =        100
            
            Expression   : Fitted values, predict()
            1._at        : market          =         200
            2._at        : market          =         400
            3._at        : market          =         600
            4._at        : market          =         800
            5._at        : market          =        1000
            6._at        : market          =        1200
            7._at        : market          =        1400
            8._at        : market          =        1600
            9._at        : market          =        1800
            10._at       : market          =        2000
            11._at       : market          =        2200
            12._at       : market          =        2400
            13._at       : market          =        2600
            14._at       : market          =        2800
            15._at       : market          =        3000
            16._at       : market          =        3200
            17._at       : market          =        3400
            18._at       : market          =        3600
            19._at       : market          =        3800
            20._at       : market          =        4000
            21._at       : market          =        4200
            22._at       : market          =        4400
            23._at       : market          =        4600
            24._at       : market          =        4800
            25._at       : market          =        5000
            26._at       : market          =        5200
            27._at       : market          =        5400
            28._at       : market          =        5600
            29._at       : market          =        5800
            30._at       : market          =        6000
            31._at       : market          =        6200
            
            -------------------------------------------------------------------------------
                          |            Delta-method
                          |     Margin   Std. Err.      z    P>|z|     [95% Conf. Interval]
            --------------+----------------------------------------------------------------
            _at#highstock |
                     1 0  |   3.590824   8.748105     0.41   0.681    -13.55515    20.73679
                     1 1  |  -31.29488   37.49927    -0.83   0.404    -104.7921    42.20235
                     2 0  |    24.4798   7.507573     3.26   0.001     9.765226    39.19437
                     2 1  |   7.659147   35.22134     0.22   0.828    -61.37341    76.69171
                     3 0  |   45.36878   6.657924     6.81   0.000     32.31948    58.41807
                     3 1  |   46.61317   33.04666     1.41   0.158     -18.1571    111.3834
                     4 0  |   66.25775   6.357847    10.42   0.000      53.7966     78.7189
                     4 1  |   85.56719   30.99697     2.76   0.006     24.81424    146.3201
                     5 0  |   87.14673   6.681801    13.04   0.000     74.05064    100.2428
                     5 1  |   124.5212   29.09871     4.28   0.000      67.4888    181.5536
                     6 0  |   108.0357    7.54988    14.31   0.000     93.23821    122.8332
                     6 1  |   163.4752   27.38336     5.97   0.000     109.8048    217.1456
                     7 0  |   128.9247    8.80255    14.65   0.000      111.672    146.1774
                     7 1  |   202.4293   25.88734     7.82   0.000      151.691    253.1675
                     8 0  |   149.8137   10.30044    14.54   0.000     129.6252    170.0021
                     8 1  |   241.3833   24.65059     9.79   0.000      193.069    289.6975
                     9 0  |   170.7026    11.9517    14.28   0.000     147.2777    194.1275
                     9 1  |   280.3373   23.71372    11.82   0.000     233.8593    326.8153
                    10 0  |   191.5916     13.701    13.98   0.000     164.7381    218.4451
                    10 1  |   319.2913   23.11322    13.81   0.000     273.9902    364.5924
                    11 0  |   212.4806    15.5152    13.69   0.000     182.0713    242.8898
                    11 1  |   358.2453    22.8756    15.66   0.000       313.41    403.0807
                    12 0  |   233.3696   17.37399    13.43   0.000     199.3172     267.422
                    12 1  |   397.1994   23.01211    17.26   0.000     352.0965    442.3023
                    13 0  |   254.2585   19.26446    13.20   0.000     216.5009    292.0162
                    13 1  |   436.1534   23.51622    18.55   0.000     390.0625    482.2443
                    14 0  |   275.1475   21.17814    12.99   0.000     233.6391    316.6559
                    14 1  |   475.1074   24.36513    19.50   0.000     427.3526    522.8622
                    15 0  |   296.0365   23.10925    12.81   0.000     250.7432    341.3298
                    15 1  |   514.0614   25.52447    20.14   0.000     464.0344    564.0885
                    16 0  |   316.9255   25.05377    12.65   0.000      267.821      366.03
                    16 1  |   553.0155    26.9542    20.52   0.000     500.1862    605.8447
                    17 0  |   337.8144    27.0088    12.51   0.000     284.8782    390.7507
                    17 1  |   591.9695   28.61383    20.69   0.000     535.8874    648.0516
                    18 0  |   358.7034   28.97222    12.38   0.000     301.9189    415.4879
                    18 1  |   630.9235    30.4658    20.71   0.000     571.2116    690.6354
                    19 0  |   379.5924   30.94242    12.27   0.000     318.9464    440.2384
                    19 1  |   669.8775   32.47723    20.63   0.000     606.2233    733.5317
                    20 0  |   400.4814   32.91819    12.17   0.000     335.9629    464.9998
                    20 1  |   708.8316   34.62034    20.47   0.000     640.9769    776.6862
                    21 0  |   421.3703   34.89858    12.07   0.000     352.9704    489.7703
                    21 1  |   747.7856   36.87216    20.28   0.000     675.5175    820.0537
                    22 0  |   442.2593   36.88285    11.99   0.000     369.9702    514.5484
                    22 1  |   786.7396   39.21399    20.06   0.000     709.8816    863.5976
                    23 0  |   463.1483   38.87041    11.92   0.000     386.9637    539.3329
                    23 1  |   825.6936   41.63063    19.83   0.000     744.0991    907.2881
                    24 0  |   484.0373   40.86077    11.85   0.000     403.9516    564.1229
                    24 1  |   864.6476   44.10978    19.60   0.000     778.1941    951.1012
                    25 0  |   504.9262   42.85354    11.78   0.000     420.9348    588.9176
                    25 1  |   903.6017   46.64149    19.37   0.000      812.186    995.0173
                    26 0  |   525.8152   44.84841    11.72   0.000     437.9139    613.7165
                    26 1  |   942.5557   49.21763    19.15   0.000     846.0909     1039.02
                    27 0  |   546.7042    46.8451    11.67   0.000     454.8895    638.5189
                    27 1  |   981.5097   51.83159    18.94   0.000     879.9217    1083.098
                    28 0  |   567.5932    48.8434    11.62   0.000     471.8619    663.3245
                    28 1  |   1020.464   54.47793    18.73   0.000      913.689    1127.239
                    29 0  |   588.4821    50.8431    11.57   0.000     488.8315    688.1328
                    29 1  |   1059.418   57.15213    18.54   0.000     947.4016    1171.434
                    30 0  |   609.3711   52.84406    11.53   0.000     505.7987    712.9436
                    30 1  |   1098.372   59.85048    18.35   0.000      981.067    1215.677
                    31 0  |   630.2601   54.84613    11.49   0.000     522.7636    737.7565
                    31 1  |   1137.326   62.56984    18.18   0.000     1014.691     1259.96
            -------------------------------------------------------------------------------
            
            . marginsplot
            Click image for larger version

Name:	Graph_xtgls.png
Views:	1
Size:	45.4 KB
ID:	1421795

            Best regards,

            Marcos

            Comment


            • #7
              I finally managed to get results. THANK YOU!! so much!!

              Comment


              • #8
                Thank you for informing your query reached a satisfactory closure.
                Best regards,

                Marcos

                Comment

                Working...
                X