link2dummy: Convert variable names to dummy variables names

Description Usage Arguments Examples

Description

When dealing with categorical variables, the estimate function convert the categorical variables into dummy variables. This function convert a set of variable names to their corresponding name in the model with dummy variables

Usage

1
2
3
4
5
6
7
var2dummy(x, ...)

## S3 method for class 'list'
var2dummy(x, var, rm.first.factor = TRUE, ...)

## S3 method for class 'lvm'
var2dummy(x, data = NULL, ...)

Arguments

x

a latent variable model.

var

the variable to be transformed.

rm.first.factor

should the first level of each categorical variable be ignored?

data

dataset according to which the model should be updated.

Examples

1
2
3
4
5
6
7
8
m <- lvm()
regression(m) <- c(y1,y2,y3)~u
regression(m) <- u ~ X1+X2
lavaSearch2:::var2dummy(m, var = c("X1","X2"))
categorical(m,labels=c("M","F","MF")) <- ~X1
lavaSearch2:::var2dummy(m, var = c("X1","X2"))
categorical(m,labels=c("1","2","3")) <- ~X2
lavaSearch2:::var2dummy(m, var = c("X1","X2"))

bozenne/lava.penalty documentation built on May 13, 2019, 1:41 a.m.