RSQ Function (OpenOffice Calc)
Use RSQ in Apache OpenOffice for squared Pearson correlation, with an intercept-fitted regression example and cautions about direction, causality and prediction.
Verification status: Eight reference formulas and 1 listed boundary case were recalculated in Apache OpenOffice 4.1.16 on Linux x86-64, Build 9816, after XLSX import, with retained ODS results. Other explanatory calculations are independent references. How formula examples are checked
Quick answer: =RSQ(B4:B8;A4:A8) returns approximately 0.6 for the worksheet below.
Availability and version history
- Introduced: First release not established. The OpenOffice.org 3.3 appendix documents RSQ; that is historical presence evidence.
- Supported in: Apache OpenOffice 4.1.16; no final supported release established.
- Scope: Desktop Calc. Formulas below use English names and semicolon argument separators, with complete numeric example ranges.
- Checked: October 14, 2026. The eight reference formulas were recalculated in Apache OpenOffice 4.1.16 on Linux x86-64, Build 9816, using XLSX import and hard recalculation. Source and independent arithmetic were also checked.
Meaning and units
RSQ squares Pearson’s correlation coefficient. For ordinary simple least-squares regression with an intercept, it equals the fraction of the observed response’s centered sum of squares explained by the fitted line. It describes the analyzed sample, not a guarantee about future prediction. Function entry.
Syntax and data requirements
=RSQ(Data1; Data2)
Exactly two arrays are required, with identical row and column dimensions. A row vector and a column vector of the same length are still different shapes. Keep paired observations aligned; dropping a value from only one side changes the relationship being analyzed. The release calculation logic is the authority for these contracts.
Reproducible worksheet
Enter this compact set of numeric observations starting in row 4. Column D is Y shifted by 10; C and E are exact straight-line transformations of X. Keep these labels outside the formula ranges.
| Row | A: X | B: Y | C: negative line | D: shifted Y | E: positive line | F: constant |
|---|---|---|---|---|---|---|
| 4 | 1 | 2 | 10 | 12 | 3 | 7 |
| 5 | 2 | 4 | 8 | 14 | 5 | 7 |
| 6 | 3 | 5 | 6 | 15 | 7 | 7 |
| 7 | 4 | 4 | 4 | 14 | 9 | 7 |
| 8 | 5 | 5 | 2 | 15 | 11 | 7 |
These eight formulas were recalculated in Apache OpenOffice 4.1.16 on Linux x86-64, Build 9816, after XLSX import. Saved ODS values match independent arithmetic; results below are rounded to twelve decimal places.
| Formula | Expected result, approximately |
|---|---|
=RSQ(B4:B8;A4:A8) |
0.6 |
=RSQ(A4:A8;B4:B8) |
0.6 |
=RSQ(C4:C8;A4:A8) |
1 |
=RSQ(D4:D8;A4:A8) |
0.6 |
=RSQ(E4:E8;A4:A8) |
1 |
=RSQ(B4:B7;A4:A7) |
0.515789473684 |
=RSQ(B5:B8;A5:A8) |
0.2 |
=RSQ(A4:A8;A4:A8) |
1 |
Practical calculation
For X in A4:A8 and Y in B4:B8, =RSQ(B4:B8;A4:A8) returns 0.6. The fitted line is y=2.2+0.6×x. Its fitted values are 2.8,3.4,4,4.6,5.2; residuals are −0.8,0.6,1,−0.6,−0.2.
Residual sum of squares is 2.4, while Y’s centered total sum of squares is 6. Thus 1−2.4/6=0.6. Saying “60% of this sample’s centered Y variation is explained by this fitted line” is more precise than calling it 60% accuracy.
Advanced checks and interpretation
Column C is a perfect decreasing line and column E a perfect increasing line. Both produce RSQ=1, although their correlations have opposite signs. Use CORREL or PEARSON if the direction must remain visible.
Do not apply the 1−SSE/SST interpretation unchanged to a regression forced through the origin, to a multiple-regression fit, or to predictions from a different model. RSQ receives only two arrays and squares their Pearson correlation; it does not inspect a separately fitted model. A high in-sample value is not an out-of-sample validation score or causal finding.
Boundaries and troubleshooting
The source rejects a zero centered sum of squares in either variable with a division-by-zero error. One usable pair is therefore insufficient, and an all-constant variable has no defined Pearson coefficient. Shape mismatch is a separate invalid-argument condition. A numerical zero coefficient is not the same as an error.
The shared implementation calculates means first and then centered cross-products, avoiding the simplest raw-sum cancellation formula. That does not eliminate all floating-point limits for very large offsets or nearly constant data.
Selected boundary cases were checked in that same native session. Error displays are retained as errors, not interpreted as numeric zero.
| Formula | Native result or display |
|---|---|
=RSQ(A4:A8;F4:F8) |
#DIV/0! |
Official evidence and checking scope
The saved ODS retained the tested formulas and numeric inputs. A deliberately stale SUM result and an uncached SUM formula confirmed recalculation. Native evidence covers the eight reference formulas and listed boundary cases in the stated 4.1.16 build; other explanatory calculations are independent references. Other releases, locales and import formats were not tested.