MathGroup Archive 2005

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

Search the Archive

changing algorithm, finding residuals w/FindFit

  • To: mathgroup at smc.vnet.net
  • Subject: [mg56714] changing algorithm, finding residuals w/FindFit
  • From: Edward Peschko <esp5 at pge.com>
  • Date: Wed, 4 May 2005 00:34:20 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

hey all,

I was wondering if there was a integral way to get the residuals that that least
squares fit offered:

	points = { { 1,2 } , { 3, 4 } , {5,6} };

	fit = FindFit[points, c + d x + e x^2, {c,d,e}, x];

	{ c -> ..., d -> ..., e -> ... }

	residuals = Residual[points, c + d + e x^2 /. fit, ResidualType -> squarex ], 


I would think that there would be a oneliner (or oneliner function) to express this 
succinctly, but I'm having difficulty expressing it.. The closest I could 
get to in perl is:

	@points = ( [1,2], [3,4], [5,6] );
	@residuals = map( [ $_->[0], ($_->[1] - &$function($_->[0]))**2 ], @$points);


Also, is there a way to change the method which is used for FindFit and 
FindMinimum/FindMaximum? I see there's a Method attribute, but there doesn't 
seem to be any options for setting it, other than 'Automatic'. In particular,
I'd like to use adaptive simulated annealing:

	http://www.ingber.com/#ASA

for more complicated functons..

Ed


  • Prev by Date: Re: debugging
  • Next by Date: Re: books on writing packages
  • Previous by thread: garbage collection and netlink
  • Next by thread: Re: changing algorithm, finding residuals w/FindFit