[R] starting values update

Uwe Ligges ligges at statistik.tu-dortmund.de
Sat Dec 27 17:08:53 CET 2008



Nadine Mugusa wrote:
> Hi all,
> does anyone know how to automatically update starting values in R?

See ?set.seed

Uwe Ligges


> I' m fitting multiple nonlinear models and would like to know how I can update starting values without having to type them in.
> thank all
> 
> 
> --- On Fri, 12/26/08, r-help-request at r-project.org <r-help-request at r-project.org> wrote:
> 
> From: r-help-request at r-project.org <r-help-request at r-project.org>
> Subject: R-help Digest, Vol 70, Issue 26
> To: r-help at r-project.org
> Date: Friday, December 26, 2008, 6:00 AM
> 
> Send R-help mailing list submissions to
> 	r-help at r-project.org
> 
> To subscribe or unsubscribe via the World Wide Web, visit
> 	https://stat.ethz.ch/mailman/listinfo/r-help
> or, via email, send a message with subject or body 'help' to
> 	r-help-request at r-project.org
> 
> You can reach the person managing the list at
> 	r-help-owner at r-project.org
> 
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of R-help digest..."
> 
> 
> Today's Topics:
> 
>    1. Re: Implementing a linear restriction in lm() (Ravi Varadhan)
>    2. p(H0|data) for lm/lmer-objects R (Leo G?rtler)
>    3. Re: beginner data.frame question (Oliver Bandel)
>    4. Re: 4 questions regarding hypothesis testing, survey package,
>       ts on samples, plotting (Thomas Lumley)
>    5. Re: How can I avoid nested 'for' loops or quicken the
>       process? (Oliver Bandel)
>    6. Re: 4 questions regarding hypothesis testing, survey package,
>       ts on samples, plotting (Peter Dalgaard)
>    7. Re: 4 questions regarding hypothesis testing, survey package,
>       ts on samples, plotting (Ben Bolker)
>    8. Re: Class and object problem (Ben Bolker)
>    9. Re: 4 questions regarding hypothesis testing, survey package,
>       ts on samples, plotting (Peter Dalgaard)
>   10. Re: p(H0|data) for lm/lmer-objects R (Daniel Malter)
>   11. Re: Implementing a linear restriction in lm() (Daniel Malter)
>   12. Re: p(H0|data) for lm/lmer-objects R (Andrew Robinson)
>   13.  Percent damage distribution (diegol)
>   14. Re: ggplot2 Xlim (Wayne F)
>   15. Re: creating standard curves for ELISA analysis (1Rnwb)
>   16. Re: Percent damage distribution (Ben Bolker)
>   17. Re: How can I avoid nested 'for' loops or quicken the
>       process? (Prof Brian Ripley)
>   18. Re: Percent damage distribution (Prof Brian Ripley)
>   19. Upgrading R causes Tinn-R to freeze. (rkevinburton at charter.net)
> 
> 
> ----------------------------------------------------------------------
> 
> Message: 1
> Date: Thu, 25 Dec 2008 11:39:33 -0500
> From: Ravi Varadhan <rvaradhan at jhmi.edu>
> Subject: Re: [R] Implementing a linear restriction in lm()
> To: Serguei Kaniovski <Serguei.Kaniovski at wifo.ac.at>
> Cc: r-help at stat.math.ethz.ch
> Message-ID: <f5bef5b03d6.495370f5 at johnshopkins.edu>
> Content-Type: text/plain; charset=iso-8859-1
> 
> Hi,
> 
> You could use the "offset" argument in lm().  Here is an example:
> 
> set.seed(123)
> x <- runif(50)
> beta <- 1
> y <- 2 + beta*x + rnorm(50)
> 
> model1 <- lm (y ~ x)
> model2 <- lm (y ~ 1, offset=x)
> 
> anova(model2, model1)
> 
> Best,
> Ravi.
> ____________________________________________________________________
> 
> Ravi Varadhan, Ph.D.
> Assistant Professor,
> Division of Geriatric Medicine and Gerontology
> School of Medicine
> Johns Hopkins University
> 
> Ph. (410) 502-2619
> email: rvaradhan at jhmi.edu
> 
> 
> ----- Original Message -----
> From: Serguei Kaniovski <Serguei.Kaniovski at wifo.ac.at>
> Date: Wednesday, December 24, 2008 9:39 pm
> Subject: [R] Implementing a linear restriction in lm()
> To: r-help at stat.math.ethz.ch
> 
> 
>>  
>>  Dear All!
>>  
>>  I want to test a coeffcient restriction beta=1 in a univariate model 
>> lm
>>  (y~x). Entering
>>  lm((y-x)~1) does not help since anova test requires the same dependent
>>  variable. What is the right way to proceed?
>>  
>>  Thank you for your help and marry xmas,
>>  Serguei Kaniovski
>>  ________________________________________
>>  Austrian?Institute?of?Economic?Research?(WIFO)
>>  
>>  P.O.Box?91??????????????????????????Tel.:?+43-1-7982601-231
>>  1103?Vienna,?Austria????????Fax:?+43-1-7989386
>>  
>>  Mail:?Serguei.Kaniovski at wifo.ac.at
>>  
>>  	[[alternative HTML version deleted]]
>>   
>> ______________________________________________
>>  R-help at r-project.org mailing list
>>  
>>  PLEASE do read the posting guide 
>>  and provide commented, minimal, self-contained, reproducible code.
> 
> 
> 
> ------------------------------
> 
> Message: 2
> Date: Thu, 25 Dec 2008 19:51:36 +0100
> From: Leo G?rtler <leog at anicca-vijja.de>
> Subject: [R] p(H0|data) for lm/lmer-objects R
> To: r-help at stat.math.ethz.ch
> Message-ID: <4953D638.4090507 at anicca-vijja.de>
> Content-Type: text/plain; charset=ISO-8859-15
> 
> Dear R-List,
> 
> I am interested in the Bayesian view on parameter estimation for
> multilevel models and ordinary regression models. AFAIU traditional
> frequentist p-values they give information about p(data_or_extreme|H0).
> AFAIU it further, p-values in the Fisherian sense are also no alpha/type
>  I errors and therefor give no information about future replications.
> 
> However, p(data_or_extreme|H0) is not really interesting for social
> science research questions (psychology). Much more interesting is
> p(H0|data). Is there a way or formula to calculate these probabilities
> of the H0 (or another hypothesis) from lm-/lmer objects in R?
> 
> Yes I know that multi-level modeling as well as regression can be done
> in a purely Bayesian way. However, I am not capable of Bayesian
> statistics, therefor I ask that question. I am starting to learn it a
> little bit.
> 
> The frequentist literature - of course - does not cover that topic.
> 
> Thanks a lot,
> best,
> 
> leo g?rtler
> 
> 
> 
> ------------------------------
> 
> Message: 3
> Date: Thu, 25 Dec 2008 19:49:58 +0000 (UTC)
> From: Oliver Bandel <oliver at first.in-berlin.de>
> Subject: Re: [R] beginner data.frame question
> To: r-help at stat.math.ethz.ch
> Message-ID: <loom.20081225T193443-238 at post.gmane.org>
> Content-Type: text/plain; charset=us-ascii
> 
> John Fox <jfox <at> mcmaster.ca> writes:
> 
>> Dear Kirk,
>>
>> Actually, co2 isn't a data frame but rather a "ts"
> (timeseries) object. A
>> nice thing about R is that you can query and examine objects:
>>
>>> class(co2)
>> [1] "ts"
> [...]
> 
> Yes.
> 
> And with 
> 
> 
>> frequency(co2)
> [1] 12
> 
> One gets "the number of observations per unit of time".
> 
> When one sets the parameter "start" and "frequency" or
> "start" and "deltat" or
> "start" and "end" of a time-series, one can set the used
> values and that means
> that functions that use those values, also will be controlled by this.
> 
>> start(co2)
> [1] 1959    1
>> end(co2)
> [1] 1997   12
> 
> 
> Rearranging by creaating a new ts-object with different
> timely parameters:
> 
>> new_co2 <- ( ts( co2,frequency=1, start=1959) )
>> start(new_co2)
> [1] 1959    1
>> end(new_co2)
> [1] 2426    1
> 
> 
> .... and the way back:
> 
>> old_co2 <- ( ts( new_co2, frequency=12, start=1959) )
>> start(old_co2)
> [1] 1959    1
>> end(old_co2)
> [1] 1997   12
> 
> 
> using plot on those values will result in different plots.
> 
> 
> Why the mentioned test data is showed different wih summary,
> [[elided Yahoo spam]]
> 
> 
> To have the test-data (or the way how it was constructed)
> could help in helping.
> 
> Ciao,
>    Oliver
> 
> 
> 
> ------------------------------
> 
> Message: 4
> Date: Thu, 25 Dec 2008 12:00:21 -0800 (PST)
> From: Thomas Lumley <tlumley at u.washington.edu>
> Subject: Re: [R] 4 questions regarding hypothesis testing, survey
> 	package, ts on samples, plotting
> To: Peter Dalgaard <p.dalgaard at biostat.ku.dk>
> Cc: r-help at r-project.org, Ben Bolker <bolker at ufl.edu>
> Message-ID:
> 	<Pine.LNX.4.43.0812251200210.24756 at hymn11.u.washington.edu>
> Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed
> 
> On Wed, 24 Dec 2008, Peter Dalgaard wrote:
> 
>> Ben Bolker wrote:
>>>
>>> Khawaja, Aman wrote:
>>>> I need to answer one of the question in my open source test is:
> What are
>>>> the four questions asked about the parameters in hypothesis
> testing?
>>>>
>>> Please check the posting guide.
>>> * We don't answer homework questions ("open source"
> doesn't mean
>>> that other people answer the questions for you, it means you can find
>>> the answers outside your own head -- and in any case, we don't
> have
>>> any of way of knowing that the test is really open).
>>> * this is not an R question but a statistics question
>>> * please don't post the same question multiple times
>>
>> Besides, this is really unanswerable without access to your teaching
> material, 
>> which probably has a list of four questions somewhere...
> 
> Starting with 'Why is this parameter different from all other
> parameters?', perhaps.
> 
>> It is a bit like the History question: "Who was what in what of
> whom?"
>>
> 
> A traditional British equivalent is "Who dragged whom how many times
> around the walls of where?", which does have just about enough context.
> 
> The R answer to the original post would probably be
> 
> 1. Why aren't there any p-values in lmer()?
> 2. How do I extract p-values from lm()?
> 3. Can R do post-hoc tests?
> 4. Can R do tests of normality?
> 
> and in statistical consulting the questions might be
> 
> 1. Doesn't that assume a Normal distribution?
> 2. Do you have a reference for that?
> 3. What was the power for that test?
> 4. Can you redo the test just in the left-handed avocado farmers[*]
> 
> 
>          -thomas
> 
> 
> 
> [*] this particular subset (c) joel on software.
> 
> Thomas Lumley			Assoc. Professor, Biostatistics
> tlumley at u.washington.edu	University of Washington, Seattle
> 
> 
> 
> ------------------------------
> 
> Message: 5
> Date: Thu, 25 Dec 2008 20:20:48 +0000 (UTC)
> From: Oliver Bandel <oliver at first.in-berlin.de>
> Subject: Re: [R] How can I avoid nested 'for' loops or quicken the
> 	process?
> To: r-help at stat.math.ethz.ch
> Message-ID: <loom.20081225T201648-168 at post.gmane.org>
> Content-Type: text/plain; charset=us-ascii
> 
> Bert Gunter <gunter.berton <at> gene.com> writes:
> 
>> FWIW:
>>
>> Good advice below! -- after all, the first rule of optimizing code is:
>> Don't!
>>
>> For the record (yet again), the apply() family of functions (and their
>> packaged derivatives, of course) are "merely" vary carefully
> written for()
>> loops: their main advantage is in code readability, not in efficiency
> gains,
>> which may well be small or nonexistent. True efficiency gains require
>> "vectorization", which essentially moves the for() loops from
> interpreted
>> code to (underlying) C code (on the underlying data structures): e.g.
>> compare rowMeans() [vectorized] with ave() or apply(..,1,mean).
> [...]
> 
> The apply-functions do bring speed-advantages.
> 
> This is not only what I read about it,
> I have used the apply-functions and really got
> results faster.
> 
> The reason is simple: an apply-function does
> make in C, what otherwise would be done on the level of R
> with for-loops.
> 
> Ciao,
>    Oliver
> 
> 
> 
> ------------------------------
> 
> Message: 6
> Date: Thu, 25 Dec 2008 21:25:58 +0100
> From: Peter Dalgaard <p.dalgaard at biostat.ku.dk>
> Subject: Re: [R] 4 questions regarding hypothesis testing, survey
> 	package, ts on samples, plotting
> To: Thomas Lumley <tlumley at u.washington.edu>
> Cc: r-help at r-project.org, Ben Bolker <bolker at ufl.edu>
> Message-ID: <4953EC56.9010808 at biostat.ku.dk>
> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
> 
> Thomas Lumley wrote:
>> On Wed, 24 Dec 2008, Peter Dalgaard wrote:
> 
>>> It is a bit like the History question: "Who was what in what of
> whom?"
>>>
>> A traditional British equivalent is "Who dragged whom how many times 
>> around the walls of where?", which does have just about enough
> context.
> 
> Yes. "Joshua, Isrelites, seven, Jericho" is wrong by a hair....
>



More information about the R-help mailing list