# [R] summary of a list

lauramorgana at bluewin.ch lauramorgana at bluewin.ch
Tue Feb 10 17:29:14 CET 2009

```Hello,
I'm using the following for loop to find regression curves using a list of functions (formList), a list of starting
values (startList), uppervalues (upperList) and lower values (lowerList).
A sample of the list of function I use in the loop is the following:

FormList <- list(PTG.P ~ fz1(Portata, a, b), PTG.P ~ fz2(Portata, a, b), PTG.P ~ fz3(Portata,a, b, d, e),
PTG.P ~ fz4(Portata, a, b), PTG.P ~ fz5(Portata, a, b, d), PO4.P ~ fz1(Portata, a, b),
PO4.P ~ fz2(Portata, a, b), ...

And the loop I use is:
resultList <- list()
for (i in 1:length(formList))
{
resultList[[i]] <- nls(formList[[i]], data=subset(dati, Fiume=="Laveggio"), start=startList[[i]],
nls.control(maxiter=1000, warnOnly=TRUE), algorithm='port', na.action=na.omit,lower=lowerList[[i]],
upper=upperList[[i]])
}
When the computation ends I get 5 warning messages (one of false convergence, 4 of singular convergence:
In nls(formList[[i]], data = subset(dati, Fiume == "Laveggio"),  : Convergence failure: false convergence (8)
2: In nls(formList[[i]], data = subset(dati, Fiume == "Laveggio"),  : Convergence failure: singular convergence (7)

If I want to get the summary of the first object of the resultList I do:
summary(resultList[])
And I get a result with no problem:
Formula: PTG.P ~ fz1(Portata, a, b)

Parameters:
Estimate Std. Error t value Pr(>|t|)
a   61.158     18.591   3.290  0.00140 **
b    7.616      8.720   0.873  0.38464
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 91.32 on 96 degrees of freedom

Algorithm "port", convergence message: both X-convergence and relative convergence (5)

It also works if I try to get the summary of the first 5 object of the resultList with:
summaryList<-list()
for (i in 1:5)
{
summaryList[[i]]<-summary(resultList[[i]])
}

But if I try to get the summary of all the objects of the resultList (there are 35 objects) it doesn't work...
I tried:
summaryList<-list()
> for (i in 1:length(resultList))
+ {
+ summaryList[[i]]<-summary(resultList[[i]])
+ }
And I got the following error message:
Error in chol2inv(object\$m\$Rmat()) : l'elemento (3, 3) è zero, quindi l'inversa non può essere calcolata
Which translated should be: Error in chol2inv(object\$m\$Rmat()): the element (3, 3) is zero (NULL?), that's why the
inverse (inverse function?) can not be computed

Does somebody have an idea on how to fix this?

Thanks
Laura

```