regression(f,x,y,ic)
Performs a non linear regression of function f(x, a1, a2, ..., ak). Arrays x and y contains the data points and array ic contains the initial values of the unknown parameters.
See also regression2 linearreg_ana
Example
To fit function f(x)=(a-c)*exp(-b*x)+c to a set of pairs (x,y) we first create a function:
f(x,a,b,c)=(a-c)*exp(-b*x)+c
f(x,a,b,c)=(a-c)*exp(-b*x)+c
The set of pairs is given by these two arrays:
x=(0,1,2,5,10,15,30,45,60)
( 0 1 2 5 10 15 30 45 60 )
y=(210,198,187,155,121,103,77,71,70)
( 210 198 187 155 121 103 77 71 70 )
Making use of function regression() we get:
regression(f,x,y)
Nonlinear Regression
Statistics:
+-----------------------+------------------+
| R squared | 0.99973 |
| R squared adjusted | 0.99964 |
| Df1 (regression) | 2 |
| Df2 (error) | 6 |
| F statistic | 11072.71052 |
| P | 0.00000 |
| SSQ | 6.91898 |
| Log-likelihood | -11.58715 |
| AIC | 3.24159 |
| BIC | 3.30733 |
+-----------------------+------------------+
Computed parameters
+----+------------------+------------------+------------------+
| | Value | Std. Error | P |
+----+------------------+------------------+------------------+
| a | 210.88273 | 0.75349 | 0.00000 |
| b | 0.09878 | 0.00190 | 0.00000 |
| c | 69.62170 | 0.73376 | 0.00000 |
+----+------------------+------------------+------------------+
Covariance matrix
+----+------------------+------------------+------------------+
| | a | b | c |
+----+------------------+------------------+------------------+
| a | 0.56775 | 0.00076 | 0.09938 |
| b | 0.00076 | 0.00000 | 0.00092 |
| c | 0.09938 | 0.00092 | 0.53841 |
+----+------------------+------------------+------------------+