Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2005
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2005

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Problems with my first package:Statistics`Common`RegressionCommon`BestFitParameters instead ofBestFitParameters

  • To: mathgroup at smc.vnet.net
  • Subject: [mg58090] Re: [mg58049] Problems with my first package:Statistics`Common`RegressionCommon`BestFitParameters instead ofBestFitParameters
  • From: "David Annetts" <davidannetts at aapt.net.au>
  • Date: Sat, 18 Jun 2005 06:07:43 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

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.


  • Prev by Date: Re: usage messages in packages
  • Next by Date: Re: For Loop and Array related
  • Previous by thread: Re: Nested Commutators
  • Next by thread: Re: Problems with my first package:Statistics`Common`RegressionCommon`BestFitParameters instead ofBestFitParameters