[R] ecdf() to nls() - how to transform data?

peter dalgaard pdalgd at gmail.com
Sun Jul 17 00:04:30 CEST 2011


On Jul 16, 2011, at 14:17 , Jochen1980 wrote:

> Hi,
> 
> I am using ecdf-function and want to use the ecdf()-data-points for nls() as
> data-parameter.
> nls() expects 'list' or 'environment' as a data-type, knots(ecdf(mydata))
> gives me 'numeric'.
> What should I do now?

Consider using fitdistr() from the MASS package. What you're trying to do is just wrong!

> 
> Thanks in advance - Jochen
> 
> Here is the code:
> #################################################
> # --- Fit ---
> # Gumbel-Dist-Function, cumulative,
> http://en.wikipedia.org/wiki/Gumbel_distribution
> #               ( - ( x - mue ) / beta )
> #          ( -e )^
> # F(x) = e^
> # formula for fitting-function
> # formula: y ~ I( exp(1) ^ ( - exp(1) ) ^ ( - ( x - mue ) / beta ) )

Ouch!!!!

Do teach yourself what exp() means. I believe that wants to be

exp( - exp( - ( x - mue ) / beta ) )


notice that fitdistr() needs the density, though. I.e. the derivative of the above with respect to x.


-- 
Peter Dalgaard
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Email: pd.mes at cbs.dk  Priv: PDalgd at gmail.com



More information about the R-help mailing list