<bestFitLine>
<bestFitLine>
is a Graphical
component computes a linear regression through a list of points.
When nested inside a <graph>
, the <bestFitLine>
component displays a line.
The equation for the line of best fit can be rendered by accessing the equation
property.
Attributes and Properties
Attribute | Type | Values |
---|---|---|
applyStyleToLabel = "…" | boolean | "true" "false" |
data = "…" | [ math ] | |
displayDecimals = "…" | integer | |
displayDigits = "…" | integer | |
displaySmallAsZero = "…" | number | |
labelIsName = "…" | boolean | "true" "false" |
labelPosition = "…" | text | "upperright" "upperleft" "lowerright" "lowerleft" |
layer = "…" | integer | |
padZeros = "…" | boolean | "true" "false" |
parallelTo = "…" | ||
perpendicularTo = "…" | ||
variables = "…" | [ _variableName ] |
Property | Type |
---|---|
$b.applyStyleToLabel | boolean |
$b.backgroundColor | text |
$b.coeff0 | math |
$b.coeffvar1 | math |
$b.coeffvar2 | math |
$b.data | [ math ] |
$b.disabled | boolean |
$b.displayDecimals | integer |
$b.displayDigits | integer |
$b.displaySmallAsZero | number |
$b.draggable | boolean |
$b.equation | math |
$b.fixed | boolean |
$b.fixLocation | boolean |
$b.hidden | boolean |
$b.label | label |
$b.labelIsName | boolean |
$b.labelPosition | text |
$b.latex | latex |
$b.layer | integer |
$b.numDimensions | number |
$b.padZeros | boolean |
$b.points | [ math ] |
$b.slope | math |
$b.styleDescription | text |
$b.styleDescriptionWithNoun | text |
$b.text | text |
$b.textColor | text |
$b.textStyleDescription | text |
$b.variables | [ _variableName ] |
$b.xintercept | math |
$b.yintercept | math |
Example: <bestFitLine>
through 3 points
A <bestFitLine>
is rendered through three named <point>
components.
Note that the data in this example are not specified as fixed
and when the points are
moved the regression line will update accordingly.
Example: <bestFitLine>
from user-input
A <bestFitLine>
is rendered through three named <point>
components.
Coordinates for the points are provided by the user with the <mathInput/>
component.
Example: Plot data and determine equation
A <bestFitLine>
is rendered through an arbitrary number of data points generated with a <callAction>
component that adds <point>
children to the named <graph>
.
The <collect>
component gathers the information required from the <graph>
to provide to the data
attribute of the <bestFitLine>
without having to assign individual names to each <point>
.
Attribute Example: data
The data
attribute specifies the data points through which to fit a regression.
Attribute Example: variables
The variables
attribute allows customization of the independent and
dependent variable name when rendering the equation of the computed regression line.
Property Example: equation
The equation
property of the named <bestFitLine>
renders the
equation of the computed regression line.
Property Example: slope
The slope
property of the named <bestFitLine>
renders the slope of the computed regression line.
Property Example: coeff0, coeffVar1, coeffVar2
Linear coefficients corresponding to the linear form
coeff0
, coeffVar2
and coeffVar1
.
Property Example: xIntercept, yIntercept
Use the xIntercept
and yIntercept
properties of the named <bestFitLine>
to determine the
intercepts of the computed regression line.
Property Example: latex
The latex
property renders the latex code for rendering the equation of the computed regression line.
Property Example: data
The data
property renders two through points computed for the linear regression.
Property Example: variables
The variables
property renders the two variables
used when rendering the
equation for the linear regression.
Property Example: numDimensions
The numDimensions
property renders the number of dimensions for the linear regression.