MathGroup Archive 2008

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

Search the Archive

FindFit and NormFunction (to find a best fit by medians)

  • To: mathgroup at smc.vnet.net
  • Subject: [mg91702] FindFit and NormFunction (to find a best fit by medians)
  • From: Stern <nycstern at gmail.com>
  • Date: Sat, 6 Sep 2008 02:05:30 -0400 (EDT)

I'm trying to use FindFit to find a best linear fit using Medians rather
than Mean

At one time, I believe the following code worked (I used it in several
places, and never noted it failing, but it hasn't been used in a while and I
don't actually remember):

FindFit[sampledata,a+b*x,{a,b},x,NormFunction->(Sqrt[Median[#^2]]&)]

Now, Mathematica seems to pass unevaluated expressions to the NormFunction,
causing Median o fail with a "rectn: Rectangular array of real numbers is
expected at position 1" error.

I would appreciate any guidance.

Michael



  • Prev by Date: compile problem
  • Next by Date: Points on a ContourPlot
  • Previous by thread: compile problem
  • Next by thread: Re: FindFit and NormFunction (to find a best fit by medians)