MathGroup Archive 2003

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

Search the Archive

Re: Fit with lists instead of functions

  • To: mathgroup at
  • Subject: [mg40297] Re: [mg40283] Fit with lists instead of functions
  • From: Dr Bob <majort at>
  • Date: Sun, 30 Mar 2003 04:09:54 -0500 (EST)
  • References: <>
  • Reply-to: majort at
  • Sender: owner-wri-mathgroup at

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 

Regress[knowns, {1, f@x, g@x, h@x, Cos@x}, x]


On Sat, 29 Mar 2003 05:20:26 -0500 (EST), Martin <martin_rommel at> 

> 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
Bobby R. Treat

  • Prev by Date: Re: Need a nice way to do this
  • Next by Date: generate random permutation
  • Previous by thread: Fit with lists instead of functions
  • Next by thread: Re: Fit with lists instead of functions