INCLAN Graphics: plot fit: Difference between revisions

From CYANA Wiki
Jump to navigation Jump to search
m (1 revision)
 
No edit summary
 
(6 intermediate revisions by the same user not shown)
Line 1: Line 1:
== Synopsis ==


Usage: plot fit ''x'' ''y'' ''s'' ''f1''...
'''plot fit''' ''x'' ''y'' ''σ'' ''f''<sub>1</sub>... (list mode)


List mode:
== Description ==
The command performs a linear least-squares fit of the basis functions  
 
given bythe vector expressions f1,... to the data points with x-coordinates,
Performs a linear least-squares fit of the basis functions given by the vector expressions ''f''<sub>1</sub>,... to the data points with ''x''-coordinates, ''y''-coordinates and errors given by the vector expressions ''x'', ''y'' and ''σ'', respectively. For ''m'' basis functions, ''f''<sub>1</sub>,... ,''f''<sub>''m''</sub>, the optimal linear combination,  
y-coordinates and errors given by the vector expressions x, y and s,
 
respectively. For m basis functions, f1,...,fm the optimal linear combination,
''y''(''x'') = ''a''<sub>1</sub>''f''<sub>1</sub>(''x'') + ... + ''a''<sub>''m''</sub>''f''<sub>''m''</sub>(''x'')
is determined by minimizing the chi^2 value. The optimal fit function is
 
added as another column to the list data. This command does not draw
is determined by minimizing
anything. The fit parameters, their standard deviations, and the
 
probability that this value of chi^2 would be exceeded by chance are
χ<sup>2</sup>(''a''<sub>1</sub>, ..., ''a''<sub>''m''</sub>) = \sum_{''i''} ((''y''<sub>''i''</sub> - ''y''(''x''<sub>''i''</sub>)) / ''σ''<sub>''i''</sub>)<sup>2</sup> 
available through the intrinsic functions fitpar, fiterr, fitchisq
and fitprob, respectively. If the errors of the data points are
where ''i'' runs over the list data points. The optimal fit function ''y''(''x'') is added as another column to the list data. This command does not draw anything. The fit parameters, ''a''<sub>1</sub>,...,''a''<sub>m</sub>, their standard deviations, χ<sup>2</sup>, and the probability that this value of χ<sup>2</sup> would be exceeded by chance are available through the intrinsic functions '''fitpar''', '''fiterr''', '''fitchisq''' and '''fitprob''', respectively. If the errors ''σ''<sub>''i''</sub> of the data points are unknown, this can be indicated by setting ''σ'' to zero in the '''fit''' command.
unkown, this can be indicated by setting s to zero in the fit command.
 
dot x y1         # plot original data points
fit x log(y1) 0 1 x # logarithmic fit of ''y'' = ''a''<sub>1</sub> exp(-''a''<sub>2</sub>''x'')
spline x exp(y2) # plot fitted curve

Latest revision as of 14:05, 13 August 2009

Synopsis

plot fit x y σ f1... (list mode)

Description

Performs a linear least-squares fit of the basis functions given by the vector expressions f1,... to the data points with x-coordinates, y-coordinates and errors given by the vector expressions x, y and σ, respectively. For m basis functions, f1,... ,fm, the optimal linear combination,

y(x) = a1f1(x) + ... + amfm(x)

is determined by minimizing

χ2(a1, ..., am) = \sum_{i} ((yi - y(xi)) / σi)2

where i runs over the list data points. The optimal fit function y(x) is added as another column to the list data. This command does not draw anything. The fit parameters, a1,...,am, their standard deviations, χ2, and the probability that this value of χ2 would be exceeded by chance are available through the intrinsic functions fitpar, fiterr, fitchisq and fitprob, respectively. If the errors σi of the data points are unknown, this can be indicated by setting σ to zero in the fit command.

dot x y1	        # plot original data points
fit x log(y1) 0 1 x	# logarithmic fit of y = a1 exp(-a2x)
spline x exp(y2)	# plot fitted curve