The RSQ function in Google Sheets is essential for statistical analysis, particularly when evaluating the strength of the relationship between two datasets. By calculating the square of the correlation coefficient, RSQ provides insight into how well one variable can predict another, making it a valuable tool for data-driven decision making.
Syntax
RSQ(known_y's, known_x's)
- known_y’s: The dependent variable’s data points.
- known_x’s: The independent variable’s data points.
Example #1
=RSQ(A1:A10, B1:B10)
This function calculates the squared Pearson correlation coefficient between the values in range A1:A10 (dependent) and B1:B10 (independent). If the two datasets have a perfect positive linear relationship, the result will be 1.
For example, if A1:A10 = {1, 2, 3, 4, 5} and B1:B10 = {2, 4, 6, 8, 10}, the RSQ function would return 1, indicating a strong correlation.
Example #2
=RSQ(C1:C10, D1:D10)
This usage computes the squared correlation for another dataset. For instance, if C1:C10 = {3, 5, 7, 9, 11} and D1:D10 = {1, 3, 7, 8, 11}, the function may return a value around 0.85, suggesting a strong but not perfect correlation between the two variables.
Example #3
=RSQ(E1:E10, F1:F10)
In this example, the function assesses the relationship between E1:E10 (let’s say rainfall) and F1:F10 (crop yield). If E1:E10 = {0, 10, 20, 30, 40} and F1:F10 = {0, 5, 10, 15, 20}, the result might be 0.98, indicating a very strong correlation, implying better yield with increased rainfall.
Error handling
- N/A: This error indicates that the function cannot calculate a result, typically due to a lack of data in the ranges provided.
- VALUE!: Occurs when non-numeric data is included in known_y’s or known_x’s. Ensure both ranges contain only numerical values.
- REF!: This error arises when the specified ranges are invalid. Double-check that the ranges referenced exist in the spreadsheet.