Announcement

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

  • LASSO in stata (plogit function)

    I am new to LASSO method (I understand it is mostly done in R, however I do not know R). So in stata there is a user written code plogit which does lasso ( byTony Brady and Gareth Ambler). Has anyone used that?
    If so, my question would be what is the optimum value of lambda (#) ? I have 20 explanatory variables. I put the lambda value 14 and i get 11 coeff. = 0.000, while lambda = 6, I get 4 vars = 0.000
    So what would be the optimum value? In the help plogit, it says "Higher values of lambda introduce more penalisation)
    Thanks a lot!


  • #2
    My search plogit yields no hits. Where did you get the plogit module from? As the FAQ explains, you are asked to explain the provenance of user-written commands. ... and while you're re-reading the FAQ, please note the remarks about using your real name in the Forum (firstname familyname) -- it's easy to change your current one by messaging the administrators: hit the Contact Us button on bottom RHS of page. Meanwhile, welcome to Statalist!

    Comment


    • #3
      It appears to be from:

      http://www.homepages.ucl.ac.uk/~ucakgam/stata.html

      The plogit package also contains plsearch to find the "best" lamba.


      Comment


      • #4
        Stephen - Sorry about the name and user-written commands: Scott, thank you very much. For the plssearch, I need to specific lambda again, what should I choose so as to get minimum (GCV) ? Also, is this command only for logistic regression? (I need the lasso method for OLS). Thanks again!

        Comment


        • #5
          Use a number list. For example

          . sysuse auto,clear
          (1978 Automobile Data)

          . plsearch fore price mpg length weight, lambda(0(.05)1) noplot trace lasso
          Lambda gcv EDF s
          0 0.530 4.00 1.00
          .05 0.526 3.66 0.90
          .1 0.521 3.21 0.81
          .15 0.518 2.84 0.76
          .2 0.519 2.80 0.73

          Penalised logistic regression (lasso) Number of obs = 74
          Effective df = 2.84
          log likelihood = -18.405728 LR chi2 (no pen)= 55.61
          ------------------------------------------------------------------------------
          foreign | Coef. Std. Err. z P>|z| [95% Conf. Interval]
          -------------+----------------------------------------------------------------
          price | .0008377 .000271 3.09 0.002 .0003065 .0013689
          mpg | -.1028828 .0927037 -1.11 0.267 -.2845786 .078813
          length | 3.20e-15 .0002994 0.00 1.000 -.0005868 .0005868
          weight | -.0061768 .0017464 -3.54 0.000 -.0095997 -.002754
          _cons | 12.85597 4.999126 2.57 0.010 3.057859 22.65407
          ------------------------------------------------------------------------------



          As for lasso for linear regression, take a look at Adrian Mander's lars:
          Code:
          ssc desc lars

          Comment


          • #6
            Thank you very much, lars is what I need, I think: However, in the example:
            sysuse auto,replace
            lars price weight length mpg turn rep78 headroom trunk displacement gear_ratio foreign, a(lasso)

            It reports, "The coefficient values for the minimum Cp"
            +-----------------------------+
            | Variable | Coefficient |
            |--------------+--------------|
            | weight | 2.9705 |
            | length | -22.6365 |
            | turn | -84.7424 |
            | rep78 | 148.2509 |
            | headroom | -496.7041 |
            | displacement | 13.0825 |
            | gear_ratio | -208.9403 |
            | foreign | 3169.5719 |
            +-----------------------------+


            In there I cannot see the var mpg : does this mean its coeff. is 0.00? How do I interpret the results above? When I do for my data set, I loose 2 vars like that.

            Thanks again!

            Comment


            • #7
              Dear all,


              I have a question about lars -- how do you change the lambda coefficient when using lasso? I tried changing the 's()' option, but this didn't seem to affect anything. In the codebook for the R version of lars (ftp://cran.r-project.org/pub/R/web/p.../lars/lars.pdf) it suggests that the mode can be changed to lambda, but this wasn't working in the Stata version.


              Many thanks,


              Jake
              Last edited by Jacob Robbins; 08 Jan 2017, 15:20.

              Comment

              Working...
              X