linear_regression: Linear Regression Functions

linear_regressionR Documentation

Linear Regression Functions

Description

Functions to perform linear regression.

Usage

simple_ordinary_least_squares(x, y)

simple_ordinary_least_squares_with_R_squared(x, y)

Arguments

x

A numeric vector.

y

A numeric vector.

Value

A two-element numeric vector containing the intercept and slope of the regression line, or a three-element vector containing the intercept, slope, and R-squared value if applicable.

See Also

Boost Documentation for more details on the mathematical background.

Examples

# Simple Ordinary Least Squares
x <- c(1, 2, 3, 4, 5)
y <- c(2, 3, 5, 7, 11)
simple_ordinary_least_squares(x, y)
# Simple Ordinary Least Squares with R-squared
simple_ordinary_least_squares_with_R_squared(x, y)

boostmath documentation built on Dec. 15, 2025, 5:07 p.m.