Regression Wizard Auto Model
Fit linear, quadratic, exponential and power regressions to your x-y data, compare R-squared and adjusted R-squared, and predict a value with a 95%.
Regression Wizard Auto Model
Calculator
Adjust values & calculateEnter your values below. Every result is computed in your browser โ no data is sent to any server.
Formula: Linear: y=a+bx | Quadratic: y=a+bx+cx^2 | Exponential: y=ae^(bx) | Power: y=ax^b
Worked example โ Raw-R2 pick: Quadratic (R2=0.9987) | Adj-R2 pick: Linear (0.9983) | Linear prediction at x=12: 24.12 | 95% CI: [23.53, 24.70]
Formula
Linear: y=a+bx | Quadratic: y=a+bx+cx^2 | Exponential: y=ae^(bx) | Power: y=ax^b
Four models are fit simultaneously. Linear uses ordinary least squares. Quadratic solves a 3x3 normal equation system. Exponential and power models are linearized via log transformation. The model highlighted as best is the one with the highest raw R-squared; adjusted R-squared, which penalizes complexity to prevent overfitting, is reported alongside every model and should be preferred when the candidates differ in parameter count.
Worked Examples
Example 1: Sales Growth Trend Analysis
Problem:Monthly sales data X=[1-10], Y=[2.1, 4.3, 5.8, 8.2, 9.9, 12.1, 14.5, 15.8, 18.2, 20.1]. Predict month 12 sales.
Solution:Sums about the means: ssXX = 82.5, ssXY = 165.2, ssYY = 331.24 Linear slope = 165.2 / 82.5 = 2.002, intercept = 11.10 - 2.002(5.5) = 0.087 Linear: y = 0.087 + 2.002x, R2 = 0.9987, adj R2 = 0.9983 Quadratic: y = 0.128 + 1.982x + 0.00189x^2, R2 = 0.9987, adj R2 = 0.9980 Power: y = 2.095 * x^0.979, R2 = 0.9985 Exponential: R2 = 0.8596 (wrong shape for this data) This page labels the highest RAW R2 as best, so it flags the quadratic, whose prediction at x=12 is 24.18. Adjusted R2 puts the line ahead, and the line is the better model here. Linear prediction at x=12: 0.087 + 2.002(12) = 24.12 Std error = 0.234, 95% CI: [23.53, 24.70] Correlation r = 0.9993
Result:Raw-R2 pick: Quadratic (R2=0.9987) | Adj-R2 pick: Linear (0.9983) | Linear prediction at x=12: 24.12 | 95% CI: [23.53, 24.70]
Example 2: Exponential Growth Detection
Problem:Bacteria count X=[0,1,2,3,4,5], Y=[100, 150, 225, 340, 510, 760]. Determine growth model.
Solution:Linear: y = 26.429 + 128.429x, R2 = 0.9255 Quadratic: y = 108.571 + 5.214x + 24.64286x^2, R2 = 0.9982 Exponential: y = 100.019 * e^(0.4064x), R2 = 1.0000 Power is not fitted here, because the log transform needs strictly positive x and this series starts at x = 0. Best model: Exponential b = 0.4064 is a continuously compounded rate, not a per-period percentage. The per-period growth factor is e^0.4064 = 1.5014, i.e. about 50.1% growth per period. Doubling time: ln(2)/0.4064 = 1.71 periods Prediction at x=7: 100.019 x e^(0.4064 x 7) = 1,720.46
Result:Best Model: Exponential (R2=1.0000) | Growth 50.1%/period (b = 0.4064 continuous) | Prediction at x=7: 1,720.46
Frequently Asked Questions
What is regression analysis and when should I use it?
Regression analysis models the relationship between a dependent variable (Y) and one or more independent variables (X) to make predictions and understand patterns. Use linear regression when you expect a constant rate of change (sales growing $1000/month). Use quadratic regression for U-shaped or inverted-U patterns (projectile motion, diminishing returns). Use exponential regression for growth/decay patterns (population growth, radioactive decay). Use power regression for scaling relationships (metabolic rate vs body mass). The key is to match the model to the underlying phenomenon and validate with R-squared and residual analysis.
What does R-squared tell me and what is a good value?
R-squared (coefficient of determination) measures the proportion of variance in Y explained by the model, ranging from 0 to 1. An R-squared of 0.85 means 85% of the variation in Y is explained by the model. What counts as 'good' depends on the field: in physics/engineering, R-squared above 0.95 is expected. In social sciences, 0.30-0.50 may be excellent. In finance, 0.10-0.30 can be meaningful. Adjusted R-squared penalizes for additional parameters, preventing overfitting. Always check residual plots alongside R-squared since a high R-squared with patterned residuals indicates a poor model choice.
How does the auto-model selection work?
Regression Wizard Auto Model fits four regression models simultaneously: linear (y = a + bx), quadratic (y = a + bx + cx^2), exponential (y = ae^bx), and power (y = ax^b). Each model's parameters are estimated using least squares (linear, quadratic) or linearized least squares (exponential, power through log transformation). Read the ranking with care: the model this page labels 'Best' is the one with the highest raw R-squared, and raw R-squared can never fall when a parameter is added, so the quadratic will edge out the line whenever their fits are close. Adjusted R-squared, which applies a complexity penalty, is shown for every model in the comparison table and is the statistic to use when the candidates differ in parameter count โ where the two disagree, prefer the adjusted figure and take the simpler model. Exponential and power models require positive data values for the log transformation to work, so the exponential fit is skipped when any y is zero or negative, and the power fit is skipped when any x or y is.
What are confidence intervals for predictions?
A confidence interval gives a range within which the true value is expected to fall with a specified probability. A 95% confidence interval for a prediction means that if you repeated the experiment many times, 95% of the intervals would contain the true value. The interval widens as you predict further from the mean of your data (extrapolation is less certain than interpolation). It also widens with more scatter in the data (higher standard error) and narrows with more data points. Regression Wizard Auto Model provides prediction intervals for the linear model, which account for both model uncertainty and individual observation variability.
What are the assumptions and limitations of regression?
Key assumptions: linearity (for linear regression), independence of observations, homoscedasticity (constant variance of residuals), and normally distributed residuals. Common violations include autocorrelation in time series data, outliers that disproportionately influence results, multicollinearity when using multiple predictors, and non-constant variance. With small sample sizes (under 30), results are less reliable and confidence intervals widen significantly. Extrapolation beyond the data range is risky since the relationship may change. Always plot your data first, check residuals, and be cautious about causal interpretations since correlation does not imply causation.
Why does taking logarithms before fitting an exponential model change the coefficients?
Fitting the model y = ae^(bx) by regressing ln y on x turns a curve into a straight line, which is why the method is fast and why it needs strictly positive data. It also changes what is minimised: squared error in log space corresponds to proportional error in the original units, so small y values pull on the fit as hard as large ones. A direct nonlinear least squares fit minimises raw residuals and returns slightly different values of a and b.
What is the difference between the correlation coefficient r and R-squared?
For a simple straight-line fit they carry the same information, because R-squared is exactly r squared. The difference is sign and scope. Correlation runs from -1 to +1 and records direction, so r = -0.9 and r = +0.9 both give R-squared 0.81. R-squared drops the direction and reports the fraction of variance the fitted curve explains, which lets it describe the quadratic, exponential and power fits as well, where a single correlation coefficient no longer applies.
How do I read the exponential slope as a growth rate and a doubling time?
In y = ae^(bx), the coefficient b is a continuously compounded rate rather than a per-period percentage. The multiplier for one step of x is e raised to b, so b = 0.405 means the value grows by a factor of about 1.50 each period, close to 50 percent, and a is the fitted value at x = 0. Doubling time is ln 2 divided by b: 0.693 / 0.405 is about 1.71 periods. A negative b gives decay and the same expression returns the half-life.
Why do small samples need a t-value instead of 1.96 for a 95 percent interval?
The 1.96 multiplier comes from the normal distribution and assumes the residual spread is known exactly. In practice it is estimated from the same data, with n minus 2 degrees of freedom once a slope and an intercept have been fitted, so the strictly correct multiplier is a Student t quantile that grows as the sample shrinks. Ten points leave eight degrees of freedom and a two-sided 95 percent t near 2.31, making a properly widened interval about 18 percent wider.
Which model should I keep when the linear and quadratic fits have almost identical R-squared?
Keep the line. Raw R-squared can never fall when a parameter is added, so a tie on that statistic is itself evidence that the extra term buys nothing. Adjusted R-squared makes the point numerically. This page computes it as 1 - (1 - R2)(n - 1)/(n - p - 1), counting p as the number of fitted parameters including the intercept, so with ten data points the unexplained share is inflated by 9/7 for the two-parameter line and 9/6 for the three-parameter quadratic. Note that this is one degree of freedom harsher than the usual convention, which writes the denominator as n - p with p including the intercept and so gives 9/8 and 9/7 for the same two models; the penalty still rises with parameter count either way, and the conclusion is unchanged. A quadratic also bends sharply outside the data range, which destabilises extrapolation.
References
Background & Theory
History
Reviewed for accuracy by Daniel Agrici, Founder & Lead Developer ยท Editorial policy
Related Calculators
โ ๏ธOperational Risk Loss Model
Model operational risk using frequency-severity analysis and Value at Risk
๐งฎColor Palette Balance AI
Calculate color palette balance ai with inputs, formulas, and instant results.
๐งฎEV Route Charge Planner Range AI
Calculate ev route charge planner range ai with inputs, formulas, and instant results.
๐งฎWork Break Pomodoro Planner AI
Calculate work break pomodoro planner ai with inputs, formulas, and instant results.
๐งฎ3D Print Time Support Estimator
Calculate 3d print time support estimator with inputs, formulas, and instant results.
๐งฎA B Test Significance Power Analyzer
Calculate a b test significance power analyzer with inputs, formulas, and instant results.
๐งฎAccessibility Contrast Optimizer WCAG
Calculate accessibility contrast optimizer wcag with inputs, formulas, and instant results.
๐งฎAd Spend Allocator Multi Channel ROAS
Calculate ad spend allocator multi channel roas with inputs, formulas, and instant results.