# Re: [R] Analysis and graphics by groups

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

Hello,

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) :

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

```--
Doutorando
Programa de Pós-Graduaçăo em Ecologia e Evoluçăo - IBRAG / UERJ
Laboratório de Ecologia de Rios e Córregos

[[alternative HTML version deleted]]

______________________________________________
R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help