inter_xij: Binary Interaction

Description Usage Arguments Value Examples

View source: R/Functions_Cross_Dep.R

Description

Interact several factors. This function allows for binary \{0,1\} interaction between observable factors xi and xj. xi and xj should be of the same length. It creates a 1 if i and j belong to the same category (xi=xj) and zero otherwise. This function also allows several factors i.e. xi and xj as vectors

Usage

1
inter_xij(xi, xj, k = length(xi))

Arguments

xi

vector of first variable terms

xj

vector of second variable terms

k

a dummy input as length of xi; does not need to be specified.

Value

vector of binaries \{0,1\} the same length as xi

Examples

1
xi=c(0,1,0); xj=c(0,1,1); inter_xij(xi,xj,2)

estsyawo/RpacSPD documentation built on Aug. 12, 2019, 5:22 a.m.