Announcement

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

  • Question about the command selectvars

    Dear all,
    I get an error when running the command selectvars.
    What's wrong with this?
    Code:
    sysuse auto,clear
    selectvars headroom trunk length displacement
    
    invalid syntax
    r(198);
    Code:
    . which selectvars
    /Applications/Stata17/ado/plus/s/selectvars.ado
    *! 1.1.0 NJC 26 January 2011 
    
    . which tuples
    /Applications/Stata17/ado/plus/t/tuples.ado
    *! 4.0.3 Joseph N. Luchman, daniel klein, & NJC 16 May 2021

    Best regards.

    Raymond Zhang
    Stata 17.0,MP

  • #2
    selectvars is from SSC, as you are asked to explain.

    In its help, there is a note dated 2011 that it is considered superseded by tuples, also from SSC. Thus, I don't offer support for selectvars.

    The request that you tell us where community-contributed commands come from does not mean where you have placed them on your system.

    Comment


    • #3
      @Nick Cox Dear Nick, I try to use tuples to choose the model which has the lowest A value.
      But I have 24 variables.This code runs very very slow.

      can you give me some suggestions to modified the code and make it more quickly.

      Code:
      global m Australia Austria Canada Denmark Finland France Germany Italy Japan Korea Mexico Netherlands NewZealand Norway Switzerland UnitedKingdom UnitedStates Singapore Philippines Indonesia Malaysia Thailand Taiwan China
      
      tuples $m ,min(5)
      
      forval i=1/`ntuples' {
          quietly reg HongKong `tuple`i''  
          local A =e(N)*log(e(rss)/e(N))+2*(e(df_m)+2)  
      }
      Best regards.

      Raymond Zhang
      Stata 17.0,MP

      Comment


      • #4
        How can I select the model which has the smallest A value?
        Best regards.

        Raymond Zhang
        Stata 17.0,MP

        Comment


        • #5
          If you have 24 possible predictors, then there are about 17 million possible models. I don't have recommendations beyond not trying them all.

          In any case all your code does is keep a result from the last model tried!

          Comment


          • #6
            Nick Cox Dear Nick,Thank you for your remind. Is there some Stata commands can help me select the model with the smallest A value?

            Many thanks.
            Best regards.

            Raymond Zhang
            Stata 17.0,MP

            Comment


            • #7
              No different ideas from me. If you want to try 16 or 17 million possible regressions, it will take a while.

              Seriously, work out how long each regression takes, and then multiply up.

              Comment


              • #8
                We have covered this exact problem before, both in private email communication and here. Assuming the regression takes 1 second to complete, you are looking at more than half a year of running time.

                Comment


                • #9
                  Raymond Zhang It's a good idea to cross-refer to previous threads that are relevant. To confirm, there is no way that selectvars is any kind of alternative to or improvement on tuples. It's entirely the other way round, as I documented 10 years ago.

                  Comment

                  Working...
                  X