hi Christiano,
the error is that FUN is not a function. That is true, the argument
that you are passing to FUN is a different class. Instead of fx, for
example, where fx is your model code below, try to write it as a
function of the arguments that you want to split by Cerca.
You might try to construct a minimal, reproducible, commented example
to help us explain what you need to do.
I don't have the gapply function and I don't know which package it is
in (perhaps you could provide that information next time) so I can't
help more than that.
Andrew
On Fri, Apr 29, 2011 at 04:31:51PM -0300, Cristiano Yuji Sasada Sato
wrote:> Hello,
>
> 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
>
> --
> Cristiano Yuji Sasada Sato
> Doutorando
> 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]]
>
> ______________________________________________
> R-help at r-project.org 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.
--
Andrew Robinson
Program Manager, ACERA
Department of Mathematics and Statistics Tel: +61-3-8344-6410
University of Melbourne, VIC 3010 Australia (prefer email)
http://www.ms.unimelb.edu.au/~andrewpr Fax: +61-3-8344-4599
http://www.acera.unimelb.edu.au/
Forest Analytics with R (Springer, 2011)
http://www.ms.unimelb.edu.au/FAwR/
Introduction to Scientific Programming and Simulation using R (CRC, 2009):
http://www.ms.unimelb.edu.au/spuRs/