Report using Fit
- To: mathgroup at smc.vnet.net
- Subject: [mg44283] Report using Fit
- From: YAT <yat at omrf.ouhsc.edu>
- Date: Tue, 4 Nov 2003 03:23:55 -0500 (EST)
- Reply-to: yat at omrf.ouhsc.edu
- Sender: owner-wri-mathgroup at wolfram.com
Hi all,
Despite the documentation, does anyone know if Fit can give best fit
parameters as Regress does? The reason I ask is that, Fit is a lot
faster than Regress if you have large volumes of data to deal with.
Regress slows down because (I assume) it is generating the "pretty"
output. Is there another way of getting at the output of Regress
(perhaps) before formatting via RegressionReport. Below is an example.
Yas
In[668]:=
Clear[b,nr,nc,ns,nv,syndat,a0,gt1,gt2]
In[650]:=
b={0.1,0.2,0.3};
nr=4;
nc=4;
ns=5;
nv=Length[b];
syndat=Range[nr*nc*ns*nv];
a0=nr*nc*ns;
In[657]:=
yVals=Transpose[Partition[syndat,a0]];
model={1,x};
var=x;
parms=RegressionReport\[Rule]BestFit;
gt1=Table[{{b,yVals[[i]]}//Transpose,model,var},{i,1,a0,1}]//Transpose;
In[662]:=
hmm=MapThread[Fit,gt];//Timing
Out[662]=
{0.03 Second,Null}
In[666]:=
gt2=Table[{{b,yVals[[i]]}//Transpose,model,var,parms},{i,1,a0,1}]//Transpose;
doublehmm=MapThread[Regress,gt];//Timing
Out[667]=
{1.21 Second,Null}