LinRegProblem: Create a New 'LinRegProblem' Object

View source: R/LinRegProblem.R

LinRegProblemR Documentation

Create a New LinRegProblem Object

Description

Create a New LinRegProblem Object

Usage

LinRegProblem(
  X,
  Y,
  add_intercept = TRUE,
  X_transform = identity,
  Y_transform = identity
)

Arguments

X

An n \times m design matrix, optionally with an intercept column present.

Y

An n-length vector or n \times 1 matrix representing the response.

add_intercept

Logical. Should an intercept column (a column of 1s) be added to X?

X_transform

One-argument transformation function to apply to X before fitting the model. Defaults to identity.

Y_transform

One-argument transformation function to apply to Y before fitting the model. Defaults to identity.

Details

This function constructs a new LinRegProblem object from its arguments. Instances of the class contain the design matrix, response vector, fitted values, and estimated coefficients for a linear model. They also contain many relevant model statistics, such as DFFITS or the covariance matrix of the coefficients. Members of the class are environments and therefore have reference semantics. Their main use is to illustrate the process of linear modeling and gather useful data about given models. By passing a LinRegProblem object as the envir argument to sub_call, you can evaluate arbitrary expressions in the context of the object, making it easy to do textbook problems.

Value

LinRegProblem object

Examples

LinRegProblem(mtcars[, -1], mtcars[, 1], Y_transform = scale)

ryan-heslin/RegLesson documentation built on Aug. 5, 2022, 9:03 p.m.