apoc.math.regr

Details

Syntax

apoc.math.regr(label, propertyY, propertyX) :: (r2, avgX, avgY, slope)

Description

Returns the coefficient of determination (R-squared) for the values of propertyY and propertyX in the given label.

Input arguments

Name

Type

Description

label

STRING

The label of the nodes to perform the regression on.

propertyY

STRING

The name of the y property.

propertyX

STRING

The name of the x property.

Return arguments

Name

Type

Description

r2

FLOAT

The coefficient of determination.

avgX

FLOAT

The average of the x values.

avgY

FLOAT

The average of the y values.

slope

FLOAT

The calculated slope.

Usage Examples

The examples in this section are based on the following sample graph:

CREATE (:REGR_TEST {x_property: 1 , y_property: 2 })
CREATE (:REGR_TEST {x_property: 2 , y_property: 3 })
CREATE (:REGR_TEST {y_property: 10000 })
CREATE (:REGR_TEST {x_property: 3 , y_property: 6 });
CALL apoc.math.regr('REGR_TEST', 'y_property', 'x_property');
Results
r2 avgX avgY slope

0.9854227405247813

2.0

3.6666666666666665

1.8571428571428572