Learn R Programming

RegSDC (version 1.0.0)

EnsureIntercept: Ensure constant term in matrix

Description

A column of ones may be added

Usage

EnsureIntercept(x)

Value

The input matrix possibly with a column of ones added

Arguments

x

Input matrix

Author

Øyvind Langsrud

Examples

Run this code
x <- matrix(c(5, 8, 4, 2, 7, 6), 3, 2)
EnsureIntercept(x)
EnsureIntercept(cbind(x, 2))
EnsureIntercept(cbind(x, 0))
EnsureIntercept(matrix(0, 4, 0))

Run the code above in your browser using DataLab