PsiLAB Help Manual
Page
Section:
Data Regression
Name:
Reg
Linear Data Regression Module.
This modules provides several special linear regression methods for various function prototypes.
Line Regression
[ b:float * m:float * sig:float ] = Reg.line
x:(float, 'a, 'b) Matrix.t
y:(float, 'a, 'b) Matrix.t
?plot:bool
()
The line function performs a linear regression of the dataset Y(X) to the function
y(x) = b + m * x
and returns the fitted parameter b,m and the standard deviation sof the regression. The vectors x and y must be of same size.
Square Regression
[ a1:float * a2:float * a3:float * sig:float ] = Reg.square
x:(float, 'a, 'b) Matrix.t
y:(float, 'a, 'b) Matrix.t
?plot:bool
()
The square function performs a linear regression of the dataset Y(X) to the function
y(x) = a 1 + a 2 * x + a 3 * x 2
and returns the fitted parameter a i and the standard deviation sof the regression. The vectors x and y must be of same size.
Cubic Regression
[ a1:float * a2:float a3:float * a4:float * sig:float ] =
Reg.cubic
x:(float, 'a, 'b) Matrix.t
y:(float, 'a, 'b) Matrix.t
?plot:bool
()
The cubic function performs a linear regression of the dataset Y(X) to the function
y(x) = a 1 + a 2 * x + a 3 * x 2 + a 4 * x 3
and returns the fitted parameter a i and the standard deviation sof the regression. The vectors x and y must be of same size.
Generic polynomial Regression
[ param:(float, 'a, 'b) Matrix.t * sig:float ] =
Reg.poly
x:(float, 'a, 'b) Matrix.t
y:(float, 'a, 'b) Matrix.t
n:int
?plot:bool
()
The poly function performs a linear regression of the dataset Y(X) to the generic polynomial
y(x) = Sum (i=1) (n+1) a i * x (i-1)
and returns the fitted parameter a i and the standard deviation sof the regression. The vectors x and y must be of same size. The parameter n determines the degree of the polynomial. For example n=2 leads to a regression of a quadratic spline.
Generic curve of degree 2 depending on 2 independent variables
[ param:(float, 'a, 'b) Matrix.t * sig:float ] =
Reg.square2d
x:(float, 'a, 'b) Matrix.t
y:(float, 'a, 'b) Matrix.t
z:(float, 'a, 'b) Matrix.t
?plot:bool
()
The square2d function performs a linear regression of the dataset Z(X,Y) to the generic curve of degree 2:
z(x,y) = a 1 + a 2 *x + a 3 *y + a 4 *x*y + a 5 *x 2 + a 6 *y 2
and returns the fitted parameter a i and the standard deviation sof the regression. The vectors x and y can be of different size, but must be consistent with z(x,y) .
Printed by PsiLAB