apoc.math.regr

Procedure APOC Core

apoc.math.regr(label, propertyY, propertyX) - It calculates the coefficient of determination (R-squared) for the values of propertyY and propertyX in the provided label

Signature

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

Input parameters

Name Type Default

label

STRING?

null

propertyY

STRING?

null

propertyX

STRING?

null

Output parameters

Name Type

r2

FLOAT?

avgX

FLOAT?

avgY

FLOAT?

slope

FLOAT?

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');
Table 1. Results
r2 avgX avgY slope

0.9854227405247813

2.0

3.6666666666666665

1.8571428571428572