Or try with a sample dataset:


Linear regression models the relationship between one predictor variable and a continuous outcome, fitting a straight line that best describes how the outcome changes as the predictor changes.
Use linear regression when you want to:
For multiple predictor variables, use Multiple Regression.
The AI generates Python code using scikit-learn and statsmodels.
| Output | What it means |
|---|---|
| Slope (coefficient) | Change in the outcome for a one-unit increase in the predictor |
| Intercept | Predicted outcome when the predictor equals zero |
| R² (R-squared) | Proportion of variance in the outcome explained by the model (0–1; higher is better) |
| p-value | Whether the relationship is statistically significant (p < 0.05 is conventional) |
| Confidence interval | Range that likely contains the true slope |
| Scenario | What to type |
|---|---|
| Sales prediction | linear regression: predict revenue from advertising_spend |
| Real estate | regression of house_price on square_footage |
| Biology | linear regression between plant height and fertilizer amount |
| Education | predict exam_score from hours_studied |
Ask the AI to generate residual plots to check these automatically.
What's the difference between linear regression and correlation? Correlation measures the strength and direction of a relationship. Linear regression quantifies the exact slope and lets you make predictions. They are related but answer different questions.
My R² is low — does that mean the model is useless? Not necessarily. A low R² means the predictor explains only a small portion of the variance, but the relationship can still be real and statistically significant. Consider adding more predictors using Multiple Regression.
How do I make predictions for new values? After fitting the model, ask the AI: "predict house_price for square_footage = 1500".
What if my outcome variable is binary (yes/no)? Linear regression is not suitable for binary outcomes. Use Logistic Regression instead.