Key Facts
- Category
- Math, Date & Finance
- Input Types
- textarea, number
- Output Type
- json
- Sample Coverage
- 4
- API Ready
- Yes
Overview
The R-Squared Calculator is a specialized tool designed to measure the goodness of fit for regression models by calculating the coefficient of determination. By comparing actual observed data against predicted values, it quantifies how much of the variance in the dependent variable is explained by the model, providing essential metrics like R², explained variance percentage, and sum of squared errors.
When to Use
- •Evaluating the accuracy of a linear or non-linear regression model after training.
- •Comparing different statistical models to determine which one better fits a specific dataset.
- •Validating forecasting results against historical data to assess predictive performance.
How It Works
- •Input your set of actual observed values and the corresponding predicted values from your model into the respective text areas.
- •Specify the desired number of decimal places to control the precision of the calculated results.
- •The tool computes the Sum of Squared Errors (SSE) and the Total Sum of Squares (SST) based on your data points.
- •The final R-squared value is derived using the formula 1 - (SSE/SST) and returned as a JSON object containing the variance percentage.
Use Cases
Examples
1. Regression Model Validation
Data Analyst- Background
- A data analyst has developed a linear regression model to predict housing prices and needs to quantify its accuracy.
- Problem
- Determine the percentage of variance in prices explained by the model to justify its use to stakeholders.
- How to Use
- Enter the actual sale prices in the 'Actual Values' field and the model's estimates in the 'Predicted Values' field.
- Example Config
-
decimalPlaces: 4 - Outcome
- The tool returns an R-squared of 0.60, indicating that 60% of the price variance is captured by the model.
2. Sales Forecast Accuracy Check
Business Intelligence Specialist- Background
- A retail company wants to evaluate how well their monthly sales forecasts matched the actual revenue generated over the last quarter.
- Problem
- Quantify the goodness of fit for the forecasting algorithm used by the inventory team.
- How to Use
- Paste the actual monthly revenue figures and the corresponding forecasted values into the calculator.
- Example Config
-
decimalPlaces: 2 - Outcome
- The result provides the explained variance percentage and the total sum of squares, highlighting the forecast's reliability.
Try with Samples
math-&-numbersRelated Hubs
FAQ
What does an R-squared value of 1.0 indicate?
It indicates a perfect fit where the model explains 100% of the variance in the data.
Can R-squared be negative?
Yes, if the chosen model fits the data worse than a horizontal line representing the mean of the actual values.
What is the difference between SSE and SST?
SSE measures the deviation of predicted values from actual values, while SST measures the deviation of actual values from their mean.
How many data points do I need?
You need at least two pairs of actual and predicted values, though more points provide a more reliable metric.
Is R-squared the same as the Correlation Coefficient?
In simple linear regression, R-squared is the square of the Pearson correlation coefficient (r).