help-octave
[Top][All Lists]

## Use leasqr.m in octave to fit data with error

 From: higgs Subject: Use leasqr.m in octave to fit data with error Date: Tue, 7 Apr 2009 13:09:03 -0700 (PDT)

```Deas Octave users,

I have a data file looks like,

data = [
10 1684.023253675213 142923.5184171736
11 1154.101457435897 79000.44034169338
12 793.8254991880336 44430.77751038589
13 548.7675124786326 24452.17758038106
...]

where the first column are variable values, the second one are data values
and the third one are corresponding errors of data on second column.

I've used function leasqr.m to fit these data to some analytic function. It
seems to work well but I'm still wondering that I've done right things with
inputs. My question is:
Is it correct to set variable "wt" of the function equal to the inverse of
error: wt = 1./data(:,3)

Many thanks,

For reference:

[f,p,kvg,iter,corp,covp,covr,stdresid,Z,r2]= ...
leasqr(x,y,pin,F,stol,niter,wt,dp,dFdp,options)

% wt = column vector (dim=length(x)) of statistical weights.  These
%   should be set to be proportional to (sqrt of var(y))^-1; (That is,
%   the covariance matrix of the data is assumed to be proportional to
%   diagonal with diagonal equal to (wt.^2)^-1.  The constant of
%   proportionality will be estimated.); default = ones(length(y),1).

--
View this message in context:
http://www.nabble.com/Use-leasqr.m-in-octave-to-fit-data-with-error-tp22937226p22937226.html
Sent from the Octave - General mailing list archive at Nabble.com.

```