Results
Add 2 or more points to see the regression line.
Click on the chart to add data points
Theory & Key Formulas
Least-squares fit: $$\hat{y} = a + b\,x$$
$$b = \frac{\sum (x_i - \bar{x})(y_i - \bar{y})}{\sum (x_i - \bar{x})^2}, \qquad a = \bar{y} - b\,\bar{x}$$
$R^2$ is the fraction of variance explained by the model; $r$ is Pearson's correlation; RMSE is the root-mean-square residual.
- What is the method of least squares?
- It finds the line that minimizes the sum of squared residuals (differences between observed values and the line). This gives the best linear fit.
- How do you interpret the correlation coefficient r?
- r=+1 is perfect positive correlation; r=0 is no correlation; r=-1 is perfect negative. |r|>0.7 is generally considered strong correlation.
- What are important caveats in regression analysis?
- Correlation does not imply causation. Outliers can strongly distort results. Always check residual plots to verify that a linear model is appropriate.
- How does multiple regression differ?
- Simple regression uses one predictor variable; multiple regression uses several. Coefficients are estimated as beta = (XtX)^-1 Xt y using matrix algebra.
🙋
I can see the simulation updating, but what exactly is being calculated here?
🎓
Great question! The simulator solves the governing equations in real time as you move the sliders. Each parameter you control directly affects the physical outcome you see in the graph. The key is to build an intuitive feel for how each variable influences the result — that's how engineers develop physical judgment.
🙋
So when I increase this parameter, the curve shifts significantly. Is that a linear relationship?
🎓
It depends on the model. Some relationships are linear, but many engineering phenomena are nonlinear. Try moving the sliders to extreme values and see if the output changes proportionally — if the graph shape changes, that's a sign of nonlinearity. This hands-on exploration is exactly what simulations are best for.
🙋
Where is this kind of analysis actually used in practice?
🎓
Constantly! Engineers run these calculations during the design phase to quickly screen parameters before investing in expensive physical tests or detailed finite element simulations. Getting comfortable with these simplified models is a real engineering skill.
Worked Example
A quality engineer collects 12 measurements of tensile strength (y, MPa) versus carbon content (x, wt%). After plotting: points cluster around y = 320 + 45x. The simulator calculates slope b = 45.2 MPa/wt%, intercept a = 318 MPa, R² = 0.91, and RMSE = 8.7 MPa. Residuals reveal one outlier at 2.1 wt% with 15 MPa deviation, suggesting measurement error or material batch variation warranting investigation.