SimpleLinearRegressionResult

The result of a simple linear regression fit (y = intercept + slope * x).

Example:

val result = simpleLinearRegression(x, y)
result.slope // change in y per unit change in x
result.intercept // predicted y when x = 0
result.rSquared // proportion of variance explained (0.0 to 1.0)
result.predict(6.0) // predict y for a new x value

Properties

Link copied to clipboard

the predicted value of y when x is zero.

Link copied to clipboard
val n: Int

the number of observations used in the regression.

Link copied to clipboard

The difference between each observed y value and the predicted value (y - predicted). Residuals sum to approximately zero for a correctly fitted model.

Link copied to clipboard

the coefficient of determination, indicating the proportion of variance in y explained by the linear relationship with x. Ranges from 0.0 (no explanatory power) to 1.0 (perfect fit). Returns 1.0 when y has zero variance (all values identical), since there is no variance left to explain.

Link copied to clipboard

the change in y for a one-unit increase in x.

Link copied to clipboard

the standard error of the intercept estimate, measuring the uncertainty in intercept.

Link copied to clipboard

the standard error of the slope estimate, measuring the uncertainty in slope. Smaller values indicate a more precise estimate.

Functions

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard

Predicts the y value for a single x value using the fitted model.

Predicts y values for an array of x values using the fitted model.

Link copied to clipboard
open override fun toString(): String