Hi R lovers! I'd like to know how to use the parameter 'start' in the function fitdistr() obviously I have to provide the initial value of the parameter to optimize except in the case of a certain set of given distribution Indeed according to the help file for fitdistr " For the following named distributions, reasonable starting values will be computed if `start' is omitted or only partially specified: `cauchy', `gamma', `logistic', `negative binomial' (R only, parametrized by `mu' and `size'), `t', `uniform', `weibull'. " However I cannot fit an univariate distribution named 'test' I get this:>fitdistr(test,"lognormal")Error in fitdistr(test, "lognormal") : `start' must be a named list> fitdistr(test,"lognormal",start$meanlog=0,start$sdlog=1)Error: syntax error How I am supposed to type a value for start depending on the distribution on which I am fitting my set thanks ****************************************************************** The sender's email address has changed to firstname.lastname@ sgcib.com. You may want to update your personal address book. Please see http://www.sgcib.com for more information. ** This message and any attachments (the "message") are confide...{{dropped}}
An example in help(fitdistr) (R 1.7.1 for Windows) is "fitdistr(x, dgamma, list(shape = 1, rate = 0.1), lower = 0.01)". Based on this, have you tried the following: >>fitdistr(test,"lognormal", start=list(meanlog=0, sdlog=1)) hope this helps. spencer graves vincent.stoliaroff at sgcib.com wrote:> Hi R lovers! > > I'd like to know how to use the parameter 'start' in the function > fitdistr() > obviously I have to provide the initial value of the parameter to optimize > except in the case of a certain set of given distribution > > > Indeed according to the help file for fitdistr > " For the following named distributions, reasonable starting values > will be computed if `start' is omitted or only partially > specified: `cauchy', `gamma', `logistic', `negative binomial' (R > only, parametrized by `mu' and `size'), `t', `uniform', `weibull'. " > > > However I cannot fit an univariate distribution named 'test' > > I get this: > > >>fitdistr(test,"lognormal") > > Error in fitdistr(test, "lognormal") : `start' must be a named list > > >>fitdistr(test,"lognormal",start$meanlog=0,start$sdlog=1) > > Error: syntax error > > How I am supposed to type a value for start depending on the distribution > on which I am fitting my set > > thanks > > > > > ****************************************************************** > The sender's email address has changed to > firstname.lastname@ sgcib.com. You may want to update your > personal address book. Please see http://www.sgcib.com for more > information. > ** > This message and any attachments (the "message") are confide...{{dropped}} > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Oups! I should have read further the help file... Thank you very much |---------+----------------------------> | | spencer.graves at PD| | | F.COM | | | | | | 07/25/03 05:02 PM| | | | |---------+----------------------------> >------------------------------------------------------------------------------------------------------------------------------| | | | To: Vincent STOLIAROFF/fr/socgen at socgen | | cc: r-help at stat.math.ethz.ch | | Subject: Re: [R] named list 'start' in fitdistr | >------------------------------------------------------------------------------------------------------------------------------| An example in help(fitdistr) (R 1.7.1 for Windows) is "fitdistr(x, dgamma, list(shape = 1, rate = 0.1), lower = 0.01)". Based on this, have you tried the following: >>fitdistr(test,"lognormal", start=list(meanlog=0, sdlog=1)) hope this helps. spencer graves vincent.stoliaroff at sgcib.com wrote:> Hi R lovers! > > I'd like to know how to use the parameter 'start' in the function > fitdistr() > obviously I have to provide the initial value of the parameter tooptimize> except in the case of a certain set of given distribution > > > Indeed according to the help file for fitdistr > " For the following named distributions, reasonable starting values > will be computed if `start' is omitted or only partially > specified: `cauchy', `gamma', `logistic', `negative binomial' (R > only, parametrized by `mu' and `size'), `t', `uniform', `weibull'."> > > However I cannot fit an univariate distribution named 'test' > > I get this: > > >>fitdistr(test,"lognormal") > > Error in fitdistr(test, "lognormal") : `start' must be a named list > > >>fitdistr(test,"lognormal",start$meanlog=0,start$sdlog=1) > > Error: syntax error > > How I am supposed to type a value for start depending on the distribution > on which I am fitting my set > > thanks > > > > > ****************************************************************** > The sender's email address has changed to > firstname.lastname@ sgcib.com. You may want to update your > personal address book. Please see http://www.sgcib.com for more > information. > ** > This message and any attachments (the "message") are confide...{{dropped}}> > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://www.stat.math.ethz.ch/mailman/listinfo/r-help****************************************************************** The sender's email address has changed to firstname.lastname@ sgcib.com. You may want to update your personal address book. Please see http://www.sgcib.com for more information. ** This message and any attachments (the "message") are confide...{{dropped}}
On Fri, 25 Jul 2003 vincent.stoliaroff at sgcib.com wrote:> Hi R lovers! > > I'd like to know how to use the parameter 'start' in the function > fitdistr()kindly provided for you in package MASS, but churlishly unattributed> obviously I have to provide the initial value of the parameter to optimize > except in the case of a certain set of given distribution > > > Indeed according to the help file for fitdistr > " For the following named distributions, reasonable starting values > will be computed if `start' is omitted or only partially > specified: `cauchy', `gamma', `logistic', `negative binomial' (R > only, parametrized by `mu' and `size'), `t', `uniform', `weibull'. " > > > However I cannot fit an univariate distribution named 'test'??? did you mean a distribution named `lognormal'?> I get this: > > >fitdistr(test,"lognormal") > Error in fitdistr(test, "lognormal") : `start' must be a named list > > > fitdistr(test,"lognormal",start$meanlog=0,start$sdlog=1) > Error: syntax error > > How I am supposed to type a value for start depending on the distribution > on which I am fitting my setOn reading the help page: start: A named list giving the parameters to be optimized with initial values. so> test <- rlnorm(100, meanlog=0, sdlog=1) > fitdistr(test, "lognormal", start=list(meanlog=0, sdlog=1))works, just like it says it would. -- Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595
x <- exp(rnorm(100))> fitdistr(x,"lognormal",start=list(meanlog=0,sdlog=1))meanlog sdlog -0.09974374 0.92352880 ( 0.09235288) ( 0.06530569)>Ruud *********** REPLY SEPARATOR *********** On 7/25/2003 at 4:50 vincent.stoliaroff at sgcib.com wrote:>Hi R lovers! > >I'd like to know how to use the parameter 'start' in the function >fitdistr() >obviously I have to provide the initial value of the parameter to optimize >except in the case of a certain set of given distribution > > >Indeed according to the help file for fitdistr >" For the following named distributions, reasonable starting values > will be computed if `start' is omitted or only partially > specified: `cauchy', `gamma', `logistic', `negative binomial' (R > only, parametrized by `mu' and `size'), `t', `uniform', `weibull'."> > >However I cannot fit an univariate distribution named 'test' > >I get this: > >>fitdistr(test,"lognormal") >Error in fitdistr(test, "lognormal") : `start' must be a named list > >> fitdistr(test,"lognormal",start$meanlog=0,start$sdlog=1) >Error: syntax error > >How I am supposed to type a value for start depending on the distribution >on which I am fitting my set > >thanks > > > > >****************************************************************** >The sender's email address has changed to >firstname.lastname@ sgcib.com. You may want to update your >personal address book. Please see http://www.sgcib.com for more >information. > ** >This message and any attachments (the "message") are confide...{{dropped}} > >______________________________________________ >R-help at stat.math.ethz.ch mailing list >https://www.stat.math.ethz.ch/mailman/listinfo/r-help
On Fri, 25 Jul 2003 vincent.stoliaroff at sgcib.com wrote:> > >fitdistr(test,"lognormal") > Error in fitdistr(test, "lognormal") : `start' must be a named list > > > fitdistr(test,"lognormal",start$meanlog=0,start$sdlog=1) > Error: syntax error > > How I am supposed to type a value for start depending on the distribution > on which I am fitting my setWell, if start is supposed to be a named list I would try that: fitdistr(test,"lognormal",start=list(meanlog=0, sdlog=1)) -thomas Thomas Lumley Assoc. Professor, Biostatistics tlumley at u.washington.edu University of Washington, Seattle