Re: Fit with lists instead of functions
- To: mathgroup at smc.vnet.net
- Subject: [mg40297] Re: [mg40283] Fit with lists instead of functions
- From: Dr Bob <majort at cox-internet.com>
- Date: Sun, 30 Mar 2003 04:09:54 -0500 (EST)
- References: <200303291020.FAA04122@smc.vnet.net>
- Reply-to: majort at cox-internet.com
- Sender: owner-wri-mathgroup at wolfram.com
Here are a couple of ways to do it. In either case, Regress can be
replaced with Fit.
Known values:
n = 10;
knowns = Sin@Range@n;
Predictor variable lists:
a = Array[Random[] &, n];
b = Range@n;
c = b^2;
The simplest thing:
Regress[Transpose@{a, b, c, knowns}, {1, x, y, z}, {x, y, z}]
A more flexible method:
f = Interpolation[a];
g = Interpolation[b];
h = Interpolation[c];
Regress[knowns, {1, f@x, g@x, h@x}, x]
The second method can be easily modified to include other predictor
functions:
Regress[knowns, {1, f@x, g@x, h@x, Cos@x}, x]
Bobby
On Sat, 29 Mar 2003 05:20:26 -0500 (EST), Martin <martin_rommel at yahoo.com>
wrote:
> It ought to be simple, I just don't know where to find it:
> I want to do a (linear, least square) fit but instead of functions in
> a variable I want to use lists of the same length as the data list.
>
> And by the way, I am still running 4.0
>
> Thanks.
>
>
--
majort at cox-internet.com
Bobby R. Treat
- References:
- Fit with lists instead of functions
- From: martin_rommel@yahoo.com (Martin)
- Fit with lists instead of functions