Re: [R] Analysis and graphics by groups

From: Cristiano Yuji Sasada Sato <>
Date: Fri, 29 Apr 2011 16:31:51 -0300


This is my first post in this e-mail list and I hope it's enough to justify calling for help. In case it's not, sorry.

I'm trying to do analysis and graphics using a factor as a criteria to split data and do the analysis/graphics for each subset of data.

Right now what I'm trying to do is to fit and plot the following logistic model, according to a third variable named "Cerca": dm_fit_T<-nls(nDMTRBgm2~(K/(1+((K-nDMTRBgm2.T.1)/nDMTRBgm2.T.1)*exp(-r))),perieph,start=list(K=3,r=0.2),trace=T)

I've found a function called gapply which seems to be what I need, but it doesn't seem to work. This is the argument I've used: gapply(perieph,FUN=nls(nDMTRBgm2~(K/(1+((K-nDMTRBgm2.T.1)/nDMTRBgm2.T.1)*exp(-r))),perieph,start=list(K=3,r=0.2),trace=T),groups="Cerca")

But I get this error message returned:
> Error in get(as.character(FUN), mode = "function", envir = envir) :
object 'FUN' of mode 'function' was not found

Can you help me doing this non-linear regression by groups work?

Also, after I manage making the regression, I'd also need fitting a line to the nDMTRBgm2~nDMTRBgm2.T.1 data using the same model above. I've used plotfit to do that with one nlm data set. Is it possible to fit each group trend line and data with different colours/symbols in one same graphic?

Thank you,

Cristiano Yuji Sasada Sato
Programa de Pós-Graduação em Ecologia e Evolução - IBRAG / UERJ
Laboratório de Ecologia de Rios e Córregos
Departamento de Ecologia - Universidade do Estado do Rio de Janeiro

	[[alternative HTML version deleted]]

______________________________________________ mailing list PLEASE do read the posting guide and provide commented, minimal, self-contained, reproducible code.

Received on Fri 29 Apr 2011 - 19:58:36 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 Sat 30 Apr 2011 - 00:20:35 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive