+ Reply to Thread
Results 1 to 3 of 3

Thread: learning ridge regression

  1. #1
    Points: 427, Level: 8
    Level completed: 54%, Points required for next Level: 23

    Posts
    26
    Thanks
    3
    Thanked 0 Times in 0 Posts

    learning ridge regression



    Please help in understanding the differnce in ridge expression and why I get the different results using 0.02


    gridge1<-lm.ridge(divorce~.,data=divusa,lambda=0.02)
    gridge
    year unemployed femlab marriage birth military
    -0.0315 -0.1182 0.4317 0.1094 -0.1279 -0.02719


    and this expression: round(coef(gridge)[2,-1],3)
    year unemployed femlab marriage birth military
    -0.195 -0.053 0.790 0.148 -0.118 -0.042

  2. #2
    RotParaTon
    Points: 46,159, Level: 100
    Level completed: 0%, Points required for next Level: 0
    Awards:
    Discussion EnderPosting AwardFrequent PosterCommunity AwardMaster Tagger
    Dason's Avatar
    Location
    Ames, IA
    Posts
    9,066
    Thanks
    211
    Thanked 1,605 Times in 1,375 Posts

    Re: learning ridge regression

    Well you didn't tell us how you fit gridge and I'm not sure if you meant for that first output to be gridge or gridge1. Also please wrap your code in [code][/code] tags so that indentation is preserved. But mainly if you're going to ask a question like this you need to provide all the relevant details. In this case that means we need to know how you fit the first model.

    But it sounds like you need to read up on ridge regression a little more because one shouldn't expect the exact same results if you use a different value for lambda.
    "His programming is malfunctioning. It begins! Get your weapons, he's going to become a killbot!!!" - bryangoodrich

  3. #3
    Points: 427, Level: 8
    Level completed: 54%, Points required for next Level: 23

    Posts
    26
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Re: learning ridge regression


    I started with the model as:
    gridge<-lm.ridge(divorce ~., data=divusa, lambda=seq(0,35,0.02))
    then found the min$gcv and used in equation:
    0.02
    2
    round(coef(gridge)[2,-1],3)
    year unemployed femlab marriage birth military
    -0.195 -0.053 0.790 0.148 -0.118 -0.042

    so doing a ridge regression using the expression I have named-gridge1 is not the same as the gridge above?

+ Reply to Thread

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts








Advertise on Talk Stats