simple_linear_regression
Fit a linear regression line with one predictor to estimate how y changes per unit x, including slope, intercept, R², and a significance test with confidence interval.
Instructions
Fit y = intercept + slope * x by ordinary least squares -- single predictor only. Reports the slope (change in y per unit of x), the intercept, R^2 (proportion of y's variance explained by x), and a significance test + confidence interval for the slope (H0: slope=0). Use pearson_correlation instead if you only need the strength of a linear association, not its actual units/magnitude.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| x | Yes | the predictor variable, one value per observation | |
| y | Yes | the outcome variable, same length and pairing order as x | |
| alpha | No | significance level for the test (and any confidence interval); default 0.05 |