RSQ Function (Gnumeric)
Learn the RSQ function in Gnumeric: Returns the square of the Pearson product moment correlation coefficient.
Verification status: Official documentation referenced; example outcomes independently reasoned or arithmetically checked where stated. Not executed in Gnumeric. How formula examples are checked
What RSQ measures (and what it does not)
RSQ returns the square of Pearson’s product-moment correlation for two paired data vectors. It describes the strength of a linear relationship without retaining its direction: r = +0.9 and r = −0.9 both give RSQ = 0.81. For ordinary simple least-squares regression with an intercept on valid numeric pairs, the same number is the familiar coefficient of determination R². Outside that context—e.g., nonlinear regression, a model without an intercept, or a multivariable model—the simple squared-correlation identity is not a general definition of fit quality. Gnumeric documents the exact purpose in its RSQ entry. [S1]
Syntax: two paired arrays
=RSQ(array1,array2)
| Position | Official argument | Input type and role | Required? / default |
|---|---|---|---|
| 1 | array1 |
First numeric paired component, e.g. observed Y B2:B6. |
Required; no default |
| 2 | array2 |
Second numeric paired component, e.g. X A2:A6. |
Required; no default |
The valid-input statistic is symmetric: exchanging both numeric vectors does not change it. Both vectors are needed; there is no Boolean cumulative argument or optional fit-model parameter. The official manual says strings and empty cells are ignored, but does not spell out every pairing and error-handling detail for malformed data. Avoid presuming how mismatched blanks are re-aligned without native verification. [S1]
Reproducible worksheet: five paired observations
Enter the values below as numbers, not text. Row 1 consists of labels; exclude row 1 from every formula. Each row is one observation, so a sort must move its X and Y cells together. Column C is an ideal straight line; column D is reverse-ranked X for additional comparisons.
| Row | A: Training hours (X) | B: Assessment score (Y) | C: Perfect-fit Y | D: Reverse-ranked X |
|---|---|---|---|---|
| 1 | Hours | Score | Reference line | Reverse |
| 2 | 1 | 2 | 3 | 5 |
| 3 | 2 | 3 | 5 | 4 |
| 4 | 3 | 5 | 7 | 3 |
| 5 | 4 | 4 | 9 | 2 |
| 6 | 5 | 6 | 11 | 1 |
Use the ranges A2:A6 for X, B2:B6 for observed Y, C2:C6 for a perfect linear Y of 2X+1, and D2:D6 for a perfect negative linear relationship with X. The entries in C and D are fixed input numbers for this reproducible table; they are not outputs from an application session. This is a small instructional dataset, not an empirical or predictive validation study.
For independent checking, the five observations have n = 5, mean(X) = 3, mean(Y) = 4, Σ(X−3)² = 10, Σ(Y−4)² = 10, and Σ(X−3)(Y−4) = 9. Consequently the best-fit line is Ŷ = 1.3 + 0.9X, the Pearson correlation is 0.9, and its square is 0.81. The residual sum of squares is 1.9. All example outputs below were independently calculated in Python and cross-checked algebraically, not observed in Gnumeric.
Worked examples and independent calculations
| Formula | Independent expected output | Meaning |
|---|---|---|
=RSQ(B2:B6,A2:A6) |
0.81 |
Square of the original correlation 0.9. |
=RSQ(A2:A6,B2:B6) |
0.81 |
Swapping valid paired inputs does not change the value. |
=RSQ(C2:C6,A2:A6) |
1 |
The ideal Y column is exactly linear in X. |
=RSQ(D2:D6,A2:A6) |
1 |
A perfectly negative linear relation still squares to one. |
=CORREL(A2:A6,B2:B6)^2 |
0.81 |
Independent identity in a fully numeric, aligned sample. |
Check the first value without relying on any application’s function implementation:
Sxy = Σ(x−x̄)(y−ȳ) = 9
Sxx = Σ(x−x̄)² = 10
Syy = Σ(y−ȳ)² = 10
Pearson r = Sxy / √(Sxx×Syy) = 9/10 = 0.9
RSQ = r² = 81/100 = 0.81
Because a squared measure loses its sign, a report claiming that 0.81 means scores increase with hours needs a second piece of evidence, such as the sign of SLOPE or CORREL. Interpreting 0.81 as “81% explained” is appropriate only for the conventional one-predictor least-squares model with intercept here, not for any arbitrary relationship.
Advanced workflow: compare correlation strength with residual error
A classroom report could show three related but distinct outputs in cells H2:H4:
=RSQ(B2:B6,A2:A6)
=SLOPE(B2:B6,A2:A6)
=STEYX(B2:B6,A2:A6)
The independent expectations are H2 = 0.81, H3 = 0.9, and H4 ≈ 0.7958224258. RSQ has no measurement unit; slope has score-units/hour; STEYX has score-units. This trio gives strength, direction, and residual scale. Since the dataset is tiny, none of the three establishes predictive reliability on new students.
For an analyst-defined screening condition (not an official statistical test):
=IF(RSQ(B2:B6,A2:A6)>=0.8,"Review this linear association","Investigate before extrapolating")
Expected: Review this linear association. The 0.8 cutoff is a business/example policy only. Investigate nonlinearity, influential data points, measurement error, or omitted variables before presenting any strong conclusion.
Exact-release source note: The official 1.12.62 source archive was checksum-verified. In src/collect.c, these paired-range functions receive GNM_ERROR_VALUE as the fallback: no accepted pairs, unequal collected lengths and failed numeric callbacks therefore follow a #VALUE! source path. Some manual entries instead name #N/A or #DIV/0 for empty/mismatched/constant inputs. Those manual tokens below are documentation claims, not confirmed runtime outcomes; the actual installed build was not executed.
Limits and errors: separate documentation from theory
- Blanks and strings: the official manual says they are ignored. In a paired measure, it is still unsafe to rely on undocumented alignment rules for partially missing rows; build a clean paired table and re-check.
- A constant column: Pearson correlation has a zero denominator, so RSQ is mathematically undefined. Do not present
0(or an invented specific Gnumeric error code) as its expected result. - An empty or unequal-length selection: the manual does not specify an exhaustive error-code table in the RSQ entry. Confirm the number of usable numeric pairs, shapes and alignments before a native diagnostic test.
- Mixed types, formula errors, arrays with differing shape: the exact coercion/error behavior needs native confirmation; use a documented all-numeric worksheet to reproduce the table first.
Input quality, limits, and troubleshooting
- Order and pairing: the first vector of
known_ysis the dependent Y variable, followed byknown_xs(independent X);RSQaccepts first and second arrays and is symmetric for valid aligned numeric inputs. Select matching cell ranges representing the same rows. Do not independently sort just one column or silently shift one range. - Numbers versus text: enter actual numeric cells. Labels must remain outside formula ranges. The official Statistics documentation does not specify every detail of coercion and alignment for each regression function; if you have text such as
'5, blanks, TRUE/FALSE, errors, or mismatched shapes, clean or pair-filter the data and test the result in your installed Gnumeric. Do not assume such entries become zeros or new pairs by row position. - Missing values: rather than filling blanks with zero or relying on unverified pair-omission semantics, build a contiguous two-column table of complete observations. Preserve each record’s identity during filtering and sorting; the apparent fit can change dramatically if pairs are misaligned.
- Mathematically undefined regressions: a zero-variance X vector contains no information about slope; constant Y makes some correlation calculations undefined. One or two valid observations are also insufficient for meaningful regression uncertainty. The exact displayed Gnumeric error is not assumed unless its official reference explicitly specifies it.
- Error-valued cells: upstream
#VALUE!,#N/A, etc. can invalidate calculations. Repair the referenced inputs instead of wrapping the entire calculation in a blanket error replacement that might hide a damaged dataset. - Decimal display and separators: these examples use English function names, a comma between arguments, and a period for decimal numbers, as illustrated in Gnumeric’s manual. Its locale is derived from the operating system. If your installed configuration differs, use the formula syntax and number formats accepted there; no alternate-locale parser was executed in this review. [S3]
- Rounded results: the decimal outputs below are display approximations from exact input integers. Use additional displayed precision to compare calculations; a tiny floating-point difference alone is not proof of changed statistical logic.
Related pages and compatibility
CORREL and PEARSON return signed Pearson coefficients; for this dataset both independently evaluate to 0.9. SLOPE estimates direction and unit change, INTERCEPT estimates the fitted Y at X zero, and STEYX expresses residual uncertainty in Y-units. LINEST provides a richer least-squares result for which the interpretation of its statistics depends on its own documented options. [S1], [S5]
Compatibility, versions and evidence boundaries
The Gnumeric 1.12-series Statistics manual lists this function by name and explicitly labels it Microsoft Excel compatible. That statement supports broad function-level compatibility; it is not a substitute for checking edge cases, function-name translation, type coercion, or file interchange in Excel or another spreadsheet. The current official GNU/GNOME 1.12 release archive identifies 1.12.62 dated 2026-09-21 as the latest release in the reviewed source series. It does not prove that the website manual has been regenerated for that exact binary build. [S1], [S4]
Platform and availability: Gnumeric is a GNOME-family spreadsheet application currently released and packaged for Linux; do not assume an up-to-date maintained Windows build or that a plugin is available in every distribution package. The official public function catalogue lists this function as Complete / Basic (registration/implementation and an upstream test classification), not as a native run of the worked examples on this page. [S2], [S4]
Validation limits: Exact official 1.12.62 source was checksum-verified and inspected, and all displayed numbers independently recalculated. No native Gnumeric execution, screenshots, locale regression or workbook round-trip tests were performed.
Dated official references — checked 2026-10-13 UTC
- [S1] Official Gnumeric Statistics manual, RSQ. Supports squared-correlation purpose,
array1,array2syntax, string/blank note and Excel compatibility. - [S2] Official Gnumeric function catalogue: RSQ Complete / Basic upstream classification, not a reported application execution.
- [S3] Gnumeric cell/formula types and localization. General syntax and locale.
- [S4] GNOME official release archive, dated 2026-09-21 for version 1.12.62.
- [S5] Gnumeric CORREL, PEARSON, LINEST, SLOPE and STEYX. Related documented functions.