Re: FindFit and LeastSquares
- To: mathgroup at smc.vnet.net
- Subject: [mg132410] Re: FindFit and LeastSquares
- From: Costa Bravo <q13a27tt at aol.com>
- Date: Mon, 10 Mar 2014 04:39:53 -0400 (EDT)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
- Delivered-to: l-mathgroup@wolfram.com
- Delivered-to: mathgroup-outx@smc.vnet.net
- Delivered-to: mathgroup-newsendx@smc.vnet.net
- References: <lfehp1$5lv$1@smc.vnet.net>
Alexandra Lipson wrote: > > data = {{1.02, .39}, {.95, .32}, {.87, .27}, {.77, .22}, {.67, .18}, {.56, \ > .15}, {.44, .13}, {.3, .12}, {.16, .13}, {.01, .15}} > > model = a*y^2 + b*x*y + c*x + d*y + e - x^2 > FindFit[data, model, {a, b, c, d, e}, {x, y}] ... > > I've been getting the error that FindFit is not a list or a rectangular > array, among others. FindFit data <-> x,y,f error !! should be data1 = Join[#, {0}] & /@ data now w = FindFit[data1, model, {a, b, c, d, e}, {x, y}] out {a -> -2.6356255, b -> 0.14364618, c -> 0.55144696, d -> 3.2229403, e -> -0.43289427} verification model1 = model /. w (#[[3]] - (model1 /. {x -> #[[1]], y -> #[[2]]})) & /@ data1 ListPlot[%] -- Costa