Responses for Box-Cox transformations
- To: mathgroup at smc.vnet.net
- Subject: [mg23514] Responses for [mg23479] Box-Cox transformations
- From: David Alan Paul <david_alan_paul at yahoo.com>
- Date: Tue, 16 May 2000 02:45:00 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
The following are answers that have been given me in response to my query
mg23479 regarding Box-Cox transformations. Thanks to both gentlemen for
their advice! -David Paul
FIRST RESPONSE:
Dear David,
Try this:
fm[fun_, startv_, opts___] :=
Module[{vars = Table[Unique[], {Length[startv]}]},
FindMinimum[
fun[Sequence @@ vars],
Evaluate[Sequence @@ MapThread[List, {vars, startv}]],
opts]];
fun[a_,b_]:=Sin[a b];
fm[fun,{0.3,0.5}]
fm does the same as FindMinimum, but takes a function symbol
and a list of starting values instead of a Sequence of variable-
startingValue pairs.
Hope that helps. Of course, you could extend this Module in
various directions. The simple idea is to generate a List of variables
inside of the module and then to use MapThread to generate a
Sequence of pairs of variables and starting values. The Evaluate is
necessary, because FindMininum has Attribute HoldAll.
Johannes Ludsteck
Centre for European Economic Research (ZEW)
Department of Labour Economics,
Human Resources and Social Policy
Phone (+49)(0)621/1235-157
Fax (+49)(0)621/1235-225
P.O.Box 103443
D-68034 Mannheim
GERMANY
Email: ludsteck at zew.de
SECOND RESPONSE:
Dear David Paul,
What you have to do is to treat your variables and starting values
as objects of their own. _Somewhere_ you have to specify them, e.g. as
vars = {x, y, z}; (* these must be symbols without a value *)
starts = {x0, y0, z0}; (* these are the starting points, substitute
directly
or give the x0,... a value respectively *)
FindMinimum[function, ##] & @@ Transpose[{vars, starts}]
FindMinimum::"fmns": "Starting value \!\(x0\) in \!\({x, x0}\) is not a
real \number."
(* the error was provoked to see the following: *)
FindMinimum[function, {x, x0}, {y, y0}, {z, z0}]
Kind regards,
Hartmut
Wolf Hartmut <hwolf at debis.com>
=====
___________________________
David Alan Paul
<david_alan_paul at yahoo.com>
___________________________
__________________________________________________
Do You Yahoo!?
Send instant messages & get email alerts with Yahoo! Messenger.
http://im.yahoo.com/