Re: Problems with my first package:Statistics`Common`RegressionCommon`BestFitParameters instead ofBestFitParameters
- To: mathgroup at smc.vnet.net
- Subject: [mg58115] Re: Problems with my first package:Statistics`Common`RegressionCommon`BestFitParameters instead ofBestFitParameters
- From: David Bailey <dave at Remove_Thisdbailey.co.uk>
- Date: Sun, 19 Jun 2005 03:43:18 -0400 (EDT)
- References: <d90soh$8uq$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
David Annetts wrote: > Hi Frank > > <snippage> > >>ExportedFunction[whatever_,options___]:=Block[{...}, >>... >>RegressResult=NonlinearRegress[...] >>... >>Return[Switch[verbosity /. {options}, >> 0, BestFitParameters /. RegressResult, >> 1, {NMinResultReport, RegressResult} >> ]]; >>] >> >>With verbosity->0, everything is fine now, but with 1 I get: >>... >>Statistics`Common`RegressionCommon`BestFitParameters -> {a -> >>0.500455, >> b -> 0.999833}, >>... >> >>where I expected simply >> >>BestFitParameters -> {a -> 0.500455, b -> 0.999833}, >> >>Can you tell me, without me creating a minimal example, what >>I can do to simplify the Return value? > > > It's difficult to tell what the problem might be with a code excerpt, but > you might try > > Return[Switch[verbosity /. {options}, > 0, BestFitParameters /. RegressResult, > 1, NMinResultReport] > ]; > > This depends on something like > NMinResultReport = {various options} /. RegressResult; > in your function. > > I'd also recommend using True and False rather than 0 and 1 for your > options. Yes, we can write Fortran in Mathematica, but why bother, since > True is so much easier to read, and more keeping with other Mathematica > functions. > > Regards, > > Dave. > Even Fortran has a LOGICAL data type! David Bailey http://www.dbaileyconsultancy.co.uk