ols: Ordinary least squares.

View source: R/ols.R

olsR Documentation

Ordinary least squares.

Description

Simple implementation of ordinary least squares that computes with sparse feature matrices.

Usage

ols(y, X, const = TRUE, w = NULL)

Arguments

y

The outcome variable.

X

The feature matrix.

const

Boolean equal to TRUE if a constant should be included.

w

A vector of weights for weighted least squares.

Value

ols returns an object of S3 class ols. An object of class ols is a list containing the following components:

coef

A vector with the regression coefficents.

y, X, const, w

Pass-through of the user-provided arguments. See above.

See Also

Other ml_wrapper: mdl_glmnet(), mdl_glm(), mdl_ranger(), mdl_xgboost()

Examples

ols_fit <- ols(rnorm(100), cbind(rnorm(100), rnorm(100)), const = TRUE)
ols_fit$coef

ddml documentation built on Oct. 3, 2024, 1:13 a.m.