Re: [R] use of sequence on ridge regression

From: Prof Brian Ripley <ripley_at_stats.ox.ac.uk>
Date: Thu, 08 May 2008 06:39:00 +0100 (BST)

On Wed, 7 May 2008, Rodrigo Briceño wrote:

> Sorry to bother with this topic, but I'm still not clear about the
> meaning of the value set that is used on lambda values. Is there a
> correct way of doing that? My doubt is how to choose those 3 values
> that appear in the example.

I think you have not yet read the help for seq(): try printing out seq(0,0.1,0.001). There are not '3 values' here, but 3 arguments to a function.

'lambda' values start at 0 (no shrinkage), and how large you want them to be is problem-specific. How many you ask for (101 here) is also problem-specific, but around 100 values is often used.

> Thanks.
>
> On Wed, May 7, 2008 at 9:29 AM, Prof Brian Ripley <ripley_at_stats.ox.ac.uk> wrote:
>> On Wed, 7 May 2008, Rodrigo Briceño wrote:
>>
>>
>>> Nice to meet you Brian. The question is about the numbers that appears
>>> after lambda (0,0, 0.1, 0.0001). I know that seq is a set of values used
>>> for testing which value fits best. But I'm not sure if I need to put
>>> whatever I think or what. I tried also with a set of 5 values and I get
>>> an error. Is there a maximum allowed?
>>>
>>
>> So you mean the set of values of lambda? It is just a set to be use for a
>> plot and for searching in the select() methods.
>>
>> There is an R function called sequence(), and it is not the same as seq().
>>
>>
>>
>>
>>>
>>> plot(lm.ridge(hipcenter ~ .,seatpos, lambda = seq(0,0.1,0.001)))
>>> select(lm.ridge(hipcenter ~ ., seatpos,lambda = seq(0,0.1,0.001)))
>>>
>>> __________________________________________________________________
>>>
>>> Rodrigo Briceño
>>> Project Manager
>>> Sanigest Internacional
>>>
>>> +506 22-91-12-00 ext. 113 Oficina Costa Rica
>>> +506 22-32-08-30 Fax
>>> +506 88-86-11-77 Celular
>>> rbriceno_at_sanigest.com
>>> www.sanigest.com
>>>
>>> MSN: jbric98_at_hotmail.com
>>> SKYPE: rbriceno1087
>>>
>>> _____________________
>>>
>>> This communication contains legal information which is privileged and
>>> confidential. It is for the exclusive use of the address and
>>> distribution, dissemination, copying or use by others is strictly
>>> prohibited. If you have received this communication by error, please
>>> delete the original message and e-mail us.
>>>
>>>
>>> Esta comunicación contiene información legal privilegiada y confidencial
>>> para el uso exclusivo del destinatario. La distribución, diseminación,
>>> copia u otro uso por terceras personas es estrictamente prohibida. Si
>>> usted ha recibido esta comunicación por error, le rogamos borrar el
>>> mensaje original y comunicárnoslo a esta misma dirección.
>>>
>>>
>>>
>>> Prof Brian Ripley wrote:
>>> What do you mean by 'the sequence option'?
>>>
>>> The authot of lm.ridge
>>>
>>> On Wed, 7 May 2008, Rodrigo Briceño wrote:
>>>
>>> Dear R users. I have a doubt about the use of the
>>> sequence option on
>>> Ridge regression. I'm trying to understand the
>>> use of this option when
>>> variables are highly linear correlated. I'm
>>> running a model where the
>>> variables HtShoes and Ht have high VIF values. My
>>> program is written
>>> below, but I'm not sure about the correct way of
>>> using the sequence
>>> option:
>>>
>>> library (faraway)
>>> data (seatpos)
>>> attach (seatpos)
>>> spos.mod <- lm(hipcenter ~ .,seatpos) summary
>>> (spos.mod)
>>> library(MASS)
>>> lm.ridge(hipcenter ~ .,seatpos)
>>> plot(lm.ridge(hipcenter ~ .,seatpos, lambda =
>>> seq(0,0.1,0.001)))
>>> select(lm.ridge(hipcenter ~ ., seatpos,lambda =
>>> seq(0,0.1,0.001)))
>>>
>>> Any advice will be appreaciated. Rodrigo B.
>>>
>>> ______________________________________________
>>> R-help_at_r-project.org mailing list
>>> https://stat.ethz.ch/mailman/listinfo/r-help
>>> PLEASE do read the posting guide
>>> http://www.R-project.org/posting-guide.html
>>> and provide commented, minimal, self-contained,
>>> reproducible code.
>>>
>>>
>>>
>>>
>>>
>>
>>
>> --
>> Brian D. Ripley, ripley_at_stats.ox.ac.uk
>> Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
>> University of Oxford, Tel: +44 1865 272861 (self)
>> 1 South Parks Road, +44 1865 272866 (PA)
>> Oxford OX1 3TG, UK Fax: +44 1865 272595
>
> ______________________________________________
> R-help_at_r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

-- 
Brian D. Ripley,                  ripley_at_stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595


______________________________________________ R-help_at_r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.

Received on Thu 08 May 2008 - 05:50:52 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 08 May 2008 - 06:30:39 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive