[R] How can I extract information from list which class is nls

Petr Pikal petr.pikal at precheza.cz
Tue Jul 18 18:35:39 CEST 2006


Hi

your fit is an object (list) and you could use some functions like 
summary or coef to extract usefull information from it or you can 
call its components on your own.


> DNase1 <- subset(DNase, Run == 1)
> 
> ## using a selfStart model
> fm1DNase1 <- nls(density ~ SSlogis(log(conc), Asym, xmid, scal), 
DNase1)
> summary(fm1DNase1)

Formula: density ~ SSlogis(log(conc), Asym, xmid, scal)

Parameters:
     Estimate Std. Error t value Pr(>|t|)    
Asym  2.34518    0.07815   30.01 2.17e-13 ***
xmid  1.48309    0.08135   18.23 1.22e-10 ***
scal  1.04146    0.03227   32.27 8.51e-14 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 

Residual standard error: 0.01919 on 13 degrees of freedom

> coef(fm1DNase1)
    Asym     xmid     scal 
2.345180 1.483090 1.041455 
> coef(fm1DNase1)[1]
   Asym 
2.34518 
>

HTH
Petr



On 18 Jul 2006 at 18:06, Xavier Barron wrote:

Date sent:      	Tue, 18 Jul 2006 18:06:00 +0200 (CEST)
From:           	Xavier Barron <xbarron at yahoo.com>
To:             	r-help at stat.math.ethz.ch
Subject:        	[R] How can I extract information from list which class is nls

> Hello!
> 
> I work with :
> R : Copyright 2006, The R Foundation for
> Statistical Computing
> Version 2.3.1 (2006-06-01)
> On Windows XP Professional (Version 2002) SP2.
> 
> At this moment I use the function "nls" combined
> with a selfStar model (SSmicmen, related to
> Michaelis-Menten equation, and provided by the
> "stats" package). 
> 
> When I realise the following operation (cf. p 59
> of the "An Introduction to R" manual,
> http://www.r-project.org/, for more details):
> 
> > fit<-nls(y~SSmicmen(x, Vm, K), df)
> > summary(fit)
> 
> I obtain the values of Vm and K. The object "fit"
> is a list of the class "nls". However I cannot
> identify the objects which are inside of "fit"
> and  which contain the values of Vm and K. 
> 
> Actually, I would like to extract these values to
> introduce them into new objects but I don't know
> how?!
> 
> Maybe, somebody could help me to solve this
> problem. It would be very helpful for me.
> 
> Best regards,
> 
> Xavier
> 
> ______________________________________________
> R-help at stat.math.ethz.ch 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.

Petr Pikal
petr.pikal at precheza.cz



More information about the R-help mailing list