Formualizer Docs

RSQ

Returns the coefficient of determination (R^2) for paired x/y data.

RSQ is the square of Pearson correlation and indicates explained linear variance.

The Formualizer engine in this repository at 0.15.0 plus unreleased changes computes the example results. Known differences from Excel are listed on this page.

Syntax

=RSQ(known_ys, known_xs)

Arguments

ArgumentTypeRequiredDefault
known_ysnumber (range)Required—
known_xsnumber (range)Required—

Remarks

  • Arrays must contain the same number of numeric observations.
  • Result is in [0, 1] for valid numeric inputs.
  • Pairing and shape mismatches return spreadsheet errors from paired-array validation.

Error cases

  • Returns #DIV/0! when either input array has zero variance.

Examples

Describe a linear fit between paired x and y observations.

Formula =RSQ({2,5,6,9},{1,2,3,4})

Expected result 0.968

Try this formula

This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.

Reverse the order of the y series while leaving x unchanged.

Formula =RSQ({9,6,5,2},{1,2,3,4})

Expected result 0.968

Try this formula

This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.

Evaluate a series whose observations lie exactly on a line.

Formula =RSQ({2,4,6},{1,2,3})

Expected result 1

Try this formula

This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.

The known x and y series must contain corresponding observations.

Formula =RSQ({2,5,6,9},{1,2,3})

Expected result #N/A

Try this formula

This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.

Perfect linear fit

Formula =RSQ({1,2,3},{2,4,6})

Expected result 1

Try this formula

This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.

Strong but imperfect linear relationship

Formula =RSQ({1,2,3},{1,2,4})

Expected result 0.964285714285714

Try this formula

This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.

Implementation

Engine source

On this page