This is an old revision of the document!
Table of Contents
Least_Squares_Fitting_of_Data
This page contains a list of all functions that are used to find a line or plane of best fit to your data.
Best Fit Plane
Best_Fit_Plane(signal, start_event_signal, end_event_signal) - Find a plane that fits the path of a point from a start event to an end event.
The resulting plane is defined by 4 components] Example: Compute a Best_Plane_Fit for one signal across a range of frames Evaluate_Expression /EXPRESSION=Best_Fit_Plane(CURRENT_SIGNAL,EVENT_LABEL::ORIGINAL::START,EVENT_LABEL::ORIGINAL::END) /SIGNAL_TYPES=TARGET /SIGNAL_FOLDER=ORIGINAL /SIGNAL_NAMES=LSK_1 /RESULT_TYPES=METRIC /RESULT_FOLDERS=PROCESSED /RESULT_NAME=LSK1_PLANE /APPLY_AS_SUFFIX_TO_SIGNAL_NAME=TRUE ; Example: Compute a Best_Plane_Fit for multiple signals at each frame of data Evaluate_Expression /EXPRESSION=Best_Fit_Plane(CURRENT_SIGNAL) /SIGNAL_TYPES=TARGET /SIGNAL_FOLDER=ORIGINAL /SIGNAL_NAMES=LSK_1+LSK_2+LSK_3 /RESULT_TYPES=DERIVED /RESULT_FOLDERS=PROCESSED /RESULT_NAME=LSK_PLANE /APPLY_AS_SUFFIX_TO_SIGNAL_NAME=TRUE ;
Best Fit Circle
Best_Fit_Circle(signal, start_event_signal, end_event_signal)
Fit a 2D circle to the path of a signal.
The algorithm computes a best fit plane to the data, rotates this plane into a principal plane, computes the center and radius, the rotates these values back into the original plane.
The result is 4 components; the X,Y,Z location of the origin and the radius.
Best Fit Sphere
Best_Fit_Sphere(signal,start_event_signal,end_event_signal)
Example : Fit a sphere to 6 points on a DIAMOND Create 6 TARGETS representing the Vertices
Create_Target
/SIGNAL_NAMES=V1
! /SIGNAL_DESCRIPTION=
/EXPRESSION=VECTOR1)
! /INCLUDE_CALFILE=FALSE
;
Create_Target
/SIGNAL_NAMES=V6
! /SIGNAL_DESCRIPTION=
/EXPRESSION=VECTOR2)
! /INCLUDE_CALFILE=FALSE
;
Evaluate_Expression
/EXPRESSION=Best_Fit_Sphere(CURRENT_SIGNAL)
/SIGNAL_TYPES=TARGET
/SIGNAL_FOLDER=ORIGINAL
/SIGNAL_NAMES=V1+V2+V3+V4+V5+V6
/RESULT_TYPES=DERIVED
! /RESULT_FOLDERS=PROCESSED
/RESULT_NAME=SPHERE
! /APPLY_AS_SUFFIX_TO_SIGNAL_NAME=FALSE
;
Note that TARGETS are created and the sphere computed has each TARGET on its surface.
Example : Create a TARGET where each frame is on a random location on the surface of a sphere of radius 1
Evaluate_Expression
/EXPRESSION=RAND(-PI(),PI(),FRAME_NUMBERS::ORIGINAL::FRAMES)
/RESULT_TYPES=DERIVED
/RESULT_FOLDERS=RADIUS
/RESULT_NAME=VERTICAL
! /APPLY_AS_SUFFIX_TO_SIGNAL_NAME=FALSE
;
Evaluate_Expression
/EXPRESSION=RAND(0,2*PI(),FRAME_NUMBERS::ORIGINAL::FRAMES)
/RESULT_TYPES=DERIVED
/RESULT_FOLDERS=RADIUS
/RESULT_NAME=HORIZONTAL
! /APPLY_AS_SUFFIX_TO_SIGNAL_NAME=FALSE
;
Create_Target
/SIGNAL_NAMES=SPHERE
! /SIGNAL_DESCRIPTION=
/EXPRESSION=VECTOR(
COS(DERIVED::RADIUS::VERTICAL)*COS(DERIVED::RADIUS::HORIZONTAL),
-COS(DERIVED::RADIUS::VERTICAL)*SIN(DERIVED::RADIUS::HORIZONTAL),
SIN(DERIVED::RADIUS::VERTICAL))
! /INCLUDE_CALFILE=FALSE
;
Evaluate_Expression
/EXPRESSION=Best_Fit_Sphere(CURRENT_SIGNAL)
/SIGNAL_TYPES=TARGET
/SIGNAL_FOLDER=ORIGINAL
/SIGNAL_NAMES=SPHERE
/RESULT_TYPES=DERIVED
! /RESULT_FOLDERS=PROCESSED
/RESULT_NAME=SPHERE
! /APPLY_AS_SUFFIX_TO_SIGNAL_NAME=FALSE
;
Simple Linear Regression
Simple_Linear_Regression(signal1, signal2, start_event, end_event); - Fit a signal to a line. Y = mX + b.
Signal2 = m Signal1 + b An explanation of the calculation can be found here or here] Signal1 and Signal2 are one component signals Resulting METRIC signal contains 6 components Slope = m → Component 1 Intercept = b → Component 2 Siga = uncertainty in m → Component 3 Sigb = uncertainty in b → Component 4 Chi2 = chi square → Component 5 Q = The R^2 statistic → Component 6