Learn R Programming

factormodel (version 1.0)

makeDummy: makeDummy

Description

This function is to make dummy variables using a discrete variable.

Usage

makeDummy(tZ)

Arguments

tZ

An input vector

Value

Returns dZ, a matrix of size length(tZ)-by-card(tZ) :

The ij-th element in dZ is 1 if tZ[i] is equal to the j-th largest value of tZ. And the ij-th element in DZ is 0 otherwise. The row sum of dZ must be 1 by construction.

Examples

Run this code
# NOT RUN {
makeDummy(c(1,2,3))

# }

Run the code above in your browser using DataLab