Profiles: Profiles generation.

Description Usage Arguments Details Value Examples

View source: R/generation.R

Description

Function to generate all possible combinations of attribute levels (i.e. all possible profiles).

Usage

1
Profiles(lvls, coding, c.lvls = NULL)

Arguments

lvls

A numeric vector which contains for each attribute the number of levels.

coding

Type of coding that needs to be used for each attribute.

c.lvls

A list containing numeric vectors with the attribute levels for each continuous attribute. The default is NULL.

Details

Valid arguments for coding are C, D and E. When using C the attribute will be treated as continuous and no coding will be applied. All possible levels should then be specified in c.lvls. If D (dummy coding) is used contr.treatment will be applied to that attribute. For E (effect coding) contr.sum will be applied.

Value

A numeric matrix which contains all possible profiles.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
# Without continuous attributes
at.lvls <- c(3, 4, 2) # 3 Attributes with respectively 3, 4 and 2 levels. 
c.type <- c("E", "E", "E") # All Effect coded.
Profiles(lvls = at.lvls, coding = c.type) # Generate profiles.

# With continuous attributes 
at.lvls <- c(3, 4, 2) # 3 attributes with respectively 3, 4 and 2 levels. 
# First attribute is dummy coded, second and third are continuous. 
c.type <- c("D", "C", "C") 
# Levels for continuous attributes, in the same order. 
con.lvls <- list(c(4, 6, 8, 10), c(7, 9))
Profiles(lvls = at.lvls, coding = c.type, c.lvls = con.lvls)

Example output

Loading required package: shiny
   Var11 Var12 Var21 Var22 Var23 Var31
1      1     0     1     0     0     1
2      0     1     1     0     0     1
3     -1    -1     1     0     0     1
4      1     0     0     1     0     1
5      0     1     0     1     0     1
6     -1    -1     0     1     0     1
7      1     0     0     0     1     1
8      0     1     0     0     1     1
9     -1    -1     0     0     1     1
10     1     0    -1    -1    -1     1
11     0     1    -1    -1    -1     1
12    -1    -1    -1    -1    -1     1
13     1     0     1     0     0    -1
14     0     1     1     0     0    -1
15    -1    -1     1     0     0    -1
16     1     0     0     1     0    -1
17     0     1     0     1     0    -1
18    -1    -1     0     1     0    -1
19     1     0     0     0     1    -1
20     0     1     0     0     1    -1
21    -1    -1     0     0     1    -1
22     1     0    -1    -1    -1    -1
23     0     1    -1    -1    -1    -1
24    -1    -1    -1    -1    -1    -1
   Var12 Var13 Var2 Var3
1      0     0    4    7
2      1     0    4    7
3      0     1    4    7
4      0     0    6    7
5      1     0    6    7
6      0     1    6    7
7      0     0    8    7
8      1     0    8    7
9      0     1    8    7
10     0     0   10    7
11     1     0   10    7
12     0     1   10    7
13     0     0    4    9
14     1     0    4    9
15     0     1    4    9
16     0     0    6    9
17     1     0    6    9
18     0     1    6    9
19     0     0    8    9
20     1     0    8    9
21     0     1    8    9
22     0     0   10    9
23     1     0   10    9
24     0     1   10    9

idefix documentation built on Nov. 27, 2020, 1:07 a.m.