Announcement

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

  • I cant set maxvar higher

    . set maxvar 20000
    no; dataset in memory has changed since last saved

    What to do?
    I have saved plenty

    I have tried
    . set maxvar 20000, clear
    no; dataset in memory has changed since last saved

  • #2
    type "clear all"

    Comment


    • #3
      the i clear my entire data set, what does that solve?

      Comment


      • #4
        To elaborate a bit, if you want to change -maxvar-, it must be done before working with data.

        Comment


        • #5
          Okay, thanks for the answers. So when i get the error message below, which i guess stems from my dataset being too big; there is nothing to do about all the variables i have created and the fact that i merged two datasets to begin with?

          . regress ln_trade ln_distw ln_gdp_both colony comlang_off begge_euro i.pair_id
          maxvar too small
          You have attempted to use an interaction with too many levels or attempted to fit a model with too
          many variables. You need to increase maxvar; it is currently 2048. Use set maxvar; see help
          maxvar.

          If you are using factor variables and included an interaction that has lots of missing cells, try
          set emptycells drop to reduce the required matrix size; see help set emptycells.

          If you are using factor variables, you might have accidentally treated a continuous variable as a
          categorical, resulting in lots of categories. Use the c. operator on such variables.

          Comment


          • #6
            Hi Anton
            I think you are trying to FIT a model by explicitly adding a large set of dummies (pair_id).
            That is in general a bad idea. MOstly because you may not be interested in those coefficients.
            Your best approach would be doing something like the following:

            Code:
            areg ln_trade ln_distw ln_gdp_both colony comlang_off begge_euro, abs(pair_id)

            Comment


            • #7
              Originally posted by Anton Kusk View Post
              Okay, thanks for the answers. So when i get the error message below, which i guess stems from my dataset being too big; there is nothing to do about all the variables i have created and the fact that i merged two datasets to begin with?

              . regress ln_trade ln_distw ln_gdp_both colony comlang_off begge_euro i.pair_id
              maxvar too small
              You have attempted to use an interaction with too many levels or attempted to fit a model with too
              many variables. You need to increase maxvar; it is currently 2048. Use set maxvar; see help
              maxvar.
              Fernando has given you good advice on how to handle estimation. Your error suggests that you are using Stata BE (see -help memory-) because the default, and maximum, maxvar is 2,048 variables. if that's true, then no matter what you do, you cannot exceed this limit with your current flavour of Stata.

              Comment


              • #8
                Yeah okay, but this means that colony, comlang and ln_dist is omitted which makes sense if they are absorbed by the pard_id fixed effects, but my begge_euro whcih means both_euro is suddenly a negative coefficient, which makes no sense for me

                Comment


                • #9
                  I also need year fixed effect, which i tried to add by; regress ln_trade ln_distw ln_gdp_both colony comlang_off begge_euro exp_time_fe
                  But i get the maxvar error here as well

                  Comment


                  • #10
                    Hi Anton
                    The advice I provide earlier remains. You are trying to estimate a model with too many variables, mostly because of interactions.
                    If some results come with unexpected signs it could be an indication of some other type of problem, but that requires further exploration and a better understanding of the data and the topic.

                    Simply said. If you are trying to add fixed effects, do not try using "i." that is a good idea only when you have a few categories. If you want to add time and pair ID fixed effects you can use the user-written command "reghdfe" (ssc install reghdfe).

                    Beyond that advice, I think you need to revise what are you trying to control, how is that being affected by the fixed effects or the time trend.
                    HTH

                    Comment


                    • #11
                      First of all, thank u very much Fernando!
                      I was able to run the exp_time fixed effects this way, but i am still lost on how to add the imp_time fixed effects and pair_id fixed effect to the same command
                      reghdfe ln_trade ln_distw ln_gdp_both colony comlang_off begge_euro, abs (exp_time)

                      I am very new to STATA, and i am so close at having this model up and running sufficiently enough to write my BA

                      Comment


                      • #12
                        reghdfe can absorb multiple fixed effects,
                        Code:
                        reghdfe ln_trade ln_distw ln_gdp_both colony comlang_off begge_euro, abs(exp_time imp_time pair_id)
                        Last edited by Øyvind Snilsberg; 02 Nov 2021, 14:12.

                        Comment


                        • #13
                          Ahh okay. THANK U!

                          And i guess the reason why distance (distw) and the other variables are omitted is simply because they are now absorbed by the fixed effects of either pair or exporter time or importer time?

                          ------------------------------------------------------------------------------
                          ln_trade | Coefficient Std. err. t P>|t| [95% conf. interval]
                          -------------+----------------------------------------------------------------
                          ln_distw | 0 (omitted)
                          ln_gdp_both | 0 (omitted)
                          colony | 0 (omitted)
                          comlang_off | 0 (omitted)
                          begge_euro | -.2241433 .171 -1.31 0.190 -.5593016 .111015
                          eu_o | 0 (omitted)
                          eu_d | 0 (omitted)
                          _cons | 16.10682 .001514 1.1e+04 0.000 16.10385 16.10978
                          ------------------------------------------------------------------------------

                          Comment


                          • #14
                            Originally posted by Anton Kusk View Post
                            And i guess the reason why distance (distw) and the other variables are omitted is simply because they are now absorbed by the fixed effects of either pair or exporter time or importer time?
                            Correct.

                            Comment


                            • #15
                              Thank u!
                              (maybe this isent Stata related, but for interpretation, do i have to remove the omitted variables from the model and run it again or?)

                              Comment

                              Working...
                              X