rsq
Square of the Pearson correlation coefficient (R²).
Syntax
Section titled “Syntax”v = rsq(knownys, knownxs)Description
Section titled “Description”Returns pearson(y, x)^2 — the coefficient of determination for a linear fit. A value in [0, 1] indicating the proportion of variance in y explained by a linear model in x.
Example
Section titled “Example”rsq([1 2 3 4], [2 4 6 8]) % 1.0