Learn R Programming

ruv (version 0.9.7.1)

design.matrix: Design Matrix

Description

Creates a design matrix.

Usage

design.matrix(a, name = "X", remove.collinear = TRUE, include.intercept = TRUE)

Arguments

a

Object from which to create a design matrix. Can be a vector, matrix, factor, or dataframe.

name

Name of the design matrix. Used to name columns that aren't already named (e.g. X1, X2, etc.)

remove.collinear

Will remove columns that are collinear, to ensure the design matrix is full rank.

include.intercept

Add an intercept to the matrix if one is not included already.

Value

A matrix.

Details

Numerical vectors are not modified. Factors are converted to dummy variables. Character vectors are converted to factors, and then to dummy variables.