v5
Added: left_to_right parameter to support plotting with respect to origin or bar_index offset
Added: plot_linear_reg function to allow for efficient plotting of linear regressions
Added:
plot_linear_reg(reg, line_style, line_color, line_width, left_to_right)
Ploting function for linear regression more effecient than the plot_reg function
Parameters:
reg (regression): (regression) Linear Regression which has been fitted to a data set.
line_style (string)
line_color (color): (color) The color of the line.
line_width (int): (int) The width of the line.
left_to_right (bool)
Returns: (polyline) The polyline for the regression.
Updated:
generate_points(reg, x, y, left_index, right_index, absolute, left_to_right)
Takes a regression object and creates chart points which can be used for plotting visuals like lines and labels.
Parameters:
reg (regression): (regression) Regression which has been fitted to a data set.
x (array<float>): (float[]) x values which coorispond to passed y values
y (array<float>): (float[]) y values which coorispond to passed x values
left_index (int): (int) The offset of the bar farthest to the realtime bar should be larger than left_index value.
right_index (int): (int) The offset of the bar closest to the realtime bar should be less than right_index value.
absolute (bool)
left_to_right (bool): (bool) Default true plots line with origin to the left
Returns: (chart.point[]) Returns an array of chart points
plot_reg(reg, x, y, left_index, right_index, absolute, left_to_right, curved, is_closed, line_style, line_color, line_width)
Simple plotting function for regression for more custom plotting use generate_points() to create points then create your own plotting function.
Parameters:
reg (regression): (regression) Regression which has been fitted to a data set.
x (array<float>): (float[]) x values which coorispond to passed y values
y (array<float>): (float[]) y values which coorispond to passed x values
left_index (int): (int) The offset of the bar farthest to the realtime bar should be larger than left_index value.
right_index (int): (int) The offset of the bar closest to the realtime bar should be less than right_index value.
absolute (bool)
left_to_right (bool): (bool) Default true plots line with origin to the left
curved (bool): (bool) If the polyline is curved or not.
is_closed (bool): (bool) If true the polyline will be closed.
line_style (string)
line_color (color): (color) The color of the line.
line_width (int): (int) The width of the line.
Returns: (polyline) The polyline for the regression.
range_list(start, stop, step)
Creates an from the start value to the stop value.
Parameters:
start (int): (float[]) The true y values.
stop (int): (float[]) The predicted y values.
step (int): (int) Positive integer. The spacing between the values. ex: start=1, stop=6, step=2: [1, 3, 5]
Returns: (float[]) An array of size stop-start
regression
Fields:
coeffs (array<float>)
degrees (array<float>)
type_linear (series string)
type_quadratic (series string)
type_cubic (series string)
type_custom (series string)
_squared_error (series float)
X (array<float>)