ModelMatrix: Overparameterized model matrix

Description Usage Arguments Value Examples

View source: R/RoundViaDummy.R

Description

All factor levels included

Usage

1
2
ModelMatrix(formula, data = NULL, mf = model.frame(formula, data =
  data), allFactor = TRUE, sparse = FALSE, formulaSums = FALSE)

Arguments

formula

formula

data

data frame

mf

model frame (alternative input instead of data)

allFactor

When TRUE all variables are coerced to factor

sparse

When TRUE sparse matrix created by sparse.model.matrix()

formulaSums

When TRUE, sparse matrix via FormulaSums()

Value

model matrix created via model.matrix(), sparse.model.matrix() or FormulaSums()

Examples

1
2
  z1 <- SmallCountData("z1")
  ModelMatrix(~region*hovedint,z1)

Example output

Loading required package: Matrix
Loading required package: SSBtools
   (Intercept) regionA regionB regionC regionD regionE regionF regionG regionH
1            1       1       0       0       0       0       0       0       0
2            1       0       1       0       0       0       0       0       0
3            1       0       0       1       0       0       0       0       0
4            1       0       0       0       1       0       0       0       0
5            1       0       0       0       0       1       0       0       0
6            1       0       0       0       0       0       1       0       0
7            1       0       0       0       0       0       0       1       0
8            1       0       0       0       0       0       0       0       1
9            1       1       0       0       0       0       0       0       0
10           1       0       1       0       0       0       0       0       0
11           1       0       0       1       0       0       0       0       0
12           1       0       0       0       1       0       0       0       0
13           1       0       0       0       0       1       0       0       0
14           1       0       0       0       0       0       1       0       0
15           1       0       0       0       0       0       0       1       0
16           1       0       0       0       0       0       0       0       1
17           1       1       0       0       0       0       0       0       0
18           1       0       1       0       0       0       0       0       0
19           1       0       0       1       0       0       0       0       0
20           1       0       0       0       1       0       0       0       0
21           1       0       0       0       0       1       0       0       0
22           1       0       0       0       0       0       1       0       0
23           1       0       0       0       0       0       0       1       0
24           1       0       0       0       0       0       0       0       1
25           1       1       0       0       0       0       0       0       0
26           1       0       1       0       0       0       0       0       0
27           1       0       0       1       0       0       0       0       0
28           1       0       0       0       1       0       0       0       0
29           1       0       0       0       0       1       0       0       0
30           1       0       0       0       0       0       1       0       0
31           1       0       0       0       0       0       0       1       0
32           1       0       0       0       0       0       0       0       1
   hovedintannet hovedintarbeid hovedintsoshjelp hovedinttrygd
1              1              0                0             0
2              1              0                0             0
3              1              0                0             0
4              1              0                0             0
5              1              0                0             0
6              1              0                0             0
7              1              0                0             0
8              1              0                0             0
9              0              1                0             0
10             0              1                0             0
11             0              1                0             0
12             0              1                0             0
13             0              1                0             0
14             0              1                0             0
15             0              1                0             0
16             0              1                0             0
17             0              0                1             0
18             0              0                1             0
19             0              0                1             0
20             0              0                1             0
21             0              0                1             0
22             0              0                1             0
23             0              0                1             0
24             0              0                1             0
25             0              0                0             1
26             0              0                0             1
27             0              0                0             1
28             0              0                0             1
29             0              0                0             1
30             0              0                0             1
31             0              0                0             1
32             0              0                0             1
   regionA:hovedintannet regionB:hovedintannet regionC:hovedintannet
1                      1                     0                     0
2                      0                     1                     0
3                      0                     0                     1
4                      0                     0                     0
5                      0                     0                     0
6                      0                     0                     0
7                      0                     0                     0
8                      0                     0                     0
9                      0                     0                     0
10                     0                     0                     0
11                     0                     0                     0
12                     0                     0                     0
13                     0                     0                     0
14                     0                     0                     0
15                     0                     0                     0
16                     0                     0                     0
17                     0                     0                     0
18                     0                     0                     0
19                     0                     0                     0
20                     0                     0                     0
21                     0                     0                     0
22                     0                     0                     0
23                     0                     0                     0
24                     0                     0                     0
25                     0                     0                     0
26                     0                     0                     0
27                     0                     0                     0
28                     0                     0                     0
29                     0                     0                     0
30                     0                     0                     0
31                     0                     0                     0
32                     0                     0                     0
   regionD:hovedintannet regionE:hovedintannet regionF:hovedintannet
1                      0                     0                     0
2                      0                     0                     0
3                      0                     0                     0
4                      1                     0                     0
5                      0                     1                     0
6                      0                     0                     1
7                      0                     0                     0
8                      0                     0                     0
9                      0                     0                     0
10                     0                     0                     0
11                     0                     0                     0
12                     0                     0                     0
13                     0                     0                     0
14                     0                     0                     0
15                     0                     0                     0
16                     0                     0                     0
17                     0                     0                     0
18                     0                     0                     0
19                     0                     0                     0
20                     0                     0                     0
21                     0                     0                     0
22                     0                     0                     0
23                     0                     0                     0
24                     0                     0                     0
25                     0                     0                     0
26                     0                     0                     0
27                     0                     0                     0
28                     0                     0                     0
29                     0                     0                     0
30                     0                     0                     0
31                     0                     0                     0
32                     0                     0                     0
   regionG:hovedintannet regionH:hovedintannet regionA:hovedintarbeid
1                      0                     0                      0
2                      0                     0                      0
3                      0                     0                      0
4                      0                     0                      0
5                      0                     0                      0
6                      0                     0                      0
7                      1                     0                      0
8                      0                     1                      0
9                      0                     0                      1
10                     0                     0                      0
11                     0                     0                      0
12                     0                     0                      0
13                     0                     0                      0
14                     0                     0                      0
15                     0                     0                      0
16                     0                     0                      0
17                     0                     0                      0
18                     0                     0                      0
19                     0                     0                      0
20                     0                     0                      0
21                     0                     0                      0
22                     0                     0                      0
23                     0                     0                      0
24                     0                     0                      0
25                     0                     0                      0
26                     0                     0                      0
27                     0                     0                      0
28                     0                     0                      0
29                     0                     0                      0
30                     0                     0                      0
31                     0                     0                      0
32                     0                     0                      0
   regionB:hovedintarbeid regionC:hovedintarbeid regionD:hovedintarbeid
1                       0                      0                      0
2                       0                      0                      0
3                       0                      0                      0
4                       0                      0                      0
5                       0                      0                      0
6                       0                      0                      0
7                       0                      0                      0
8                       0                      0                      0
9                       0                      0                      0
10                      1                      0                      0
11                      0                      1                      0
12                      0                      0                      1
13                      0                      0                      0
14                      0                      0                      0
15                      0                      0                      0
16                      0                      0                      0
17                      0                      0                      0
18                      0                      0                      0
19                      0                      0                      0
20                      0                      0                      0
21                      0                      0                      0
22                      0                      0                      0
23                      0                      0                      0
24                      0                      0                      0
25                      0                      0                      0
26                      0                      0                      0
27                      0                      0                      0
28                      0                      0                      0
29                      0                      0                      0
30                      0                      0                      0
31                      0                      0                      0
32                      0                      0                      0
   regionE:hovedintarbeid regionF:hovedintarbeid regionG:hovedintarbeid
1                       0                      0                      0
2                       0                      0                      0
3                       0                      0                      0
4                       0                      0                      0
5                       0                      0                      0
6                       0                      0                      0
7                       0                      0                      0
8                       0                      0                      0
9                       0                      0                      0
10                      0                      0                      0
11                      0                      0                      0
12                      0                      0                      0
13                      1                      0                      0
14                      0                      1                      0
15                      0                      0                      1
16                      0                      0                      0
17                      0                      0                      0
18                      0                      0                      0
19                      0                      0                      0
20                      0                      0                      0
21                      0                      0                      0
22                      0                      0                      0
23                      0                      0                      0
24                      0                      0                      0
25                      0                      0                      0
26                      0                      0                      0
27                      0                      0                      0
28                      0                      0                      0
29                      0                      0                      0
30                      0                      0                      0
31                      0                      0                      0
32                      0                      0                      0
   regionH:hovedintarbeid regionA:hovedintsoshjelp regionB:hovedintsoshjelp
1                       0                        0                        0
2                       0                        0                        0
3                       0                        0                        0
4                       0                        0                        0
5                       0                        0                        0
6                       0                        0                        0
7                       0                        0                        0
8                       0                        0                        0
9                       0                        0                        0
10                      0                        0                        0
11                      0                        0                        0
12                      0                        0                        0
13                      0                        0                        0
14                      0                        0                        0
15                      0                        0                        0
16                      1                        0                        0
17                      0                        1                        0
18                      0                        0                        1
19                      0                        0                        0
20                      0                        0                        0
21                      0                        0                        0
22                      0                        0                        0
23                      0                        0                        0
24                      0                        0                        0
25                      0                        0                        0
26                      0                        0                        0
27                      0                        0                        0
28                      0                        0                        0
29                      0                        0                        0
30                      0                        0                        0
31                      0                        0                        0
32                      0                        0                        0
   regionC:hovedintsoshjelp regionD:hovedintsoshjelp regionE:hovedintsoshjelp
1                         0                        0                        0
2                         0                        0                        0
3                         0                        0                        0
4                         0                        0                        0
5                         0                        0                        0
6                         0                        0                        0
7                         0                        0                        0
8                         0                        0                        0
9                         0                        0                        0
10                        0                        0                        0
11                        0                        0                        0
12                        0                        0                        0
13                        0                        0                        0
14                        0                        0                        0
15                        0                        0                        0
16                        0                        0                        0
17                        0                        0                        0
18                        0                        0                        0
19                        1                        0                        0
20                        0                        1                        0
21                        0                        0                        1
22                        0                        0                        0
23                        0                        0                        0
24                        0                        0                        0
25                        0                        0                        0
26                        0                        0                        0
27                        0                        0                        0
28                        0                        0                        0
29                        0                        0                        0
30                        0                        0                        0
31                        0                        0                        0
32                        0                        0                        0
   regionF:hovedintsoshjelp regionG:hovedintsoshjelp regionH:hovedintsoshjelp
1                         0                        0                        0
2                         0                        0                        0
3                         0                        0                        0
4                         0                        0                        0
5                         0                        0                        0
6                         0                        0                        0
7                         0                        0                        0
8                         0                        0                        0
9                         0                        0                        0
10                        0                        0                        0
11                        0                        0                        0
12                        0                        0                        0
13                        0                        0                        0
14                        0                        0                        0
15                        0                        0                        0
16                        0                        0                        0
17                        0                        0                        0
18                        0                        0                        0
19                        0                        0                        0
20                        0                        0                        0
21                        0                        0                        0
22                        1                        0                        0
23                        0                        1                        0
24                        0                        0                        1
25                        0                        0                        0
26                        0                        0                        0
27                        0                        0                        0
28                        0                        0                        0
29                        0                        0                        0
30                        0                        0                        0
31                        0                        0                        0
32                        0                        0                        0
   regionA:hovedinttrygd regionB:hovedinttrygd regionC:hovedinttrygd
1                      0                     0                     0
2                      0                     0                     0
3                      0                     0                     0
4                      0                     0                     0
5                      0                     0                     0
6                      0                     0                     0
7                      0                     0                     0
8                      0                     0                     0
9                      0                     0                     0
10                     0                     0                     0
11                     0                     0                     0
12                     0                     0                     0
13                     0                     0                     0
14                     0                     0                     0
15                     0                     0                     0
16                     0                     0                     0
17                     0                     0                     0
18                     0                     0                     0
19                     0                     0                     0
20                     0                     0                     0
21                     0                     0                     0
22                     0                     0                     0
23                     0                     0                     0
24                     0                     0                     0
25                     1                     0                     0
26                     0                     1                     0
27                     0                     0                     1
28                     0                     0                     0
29                     0                     0                     0
30                     0                     0                     0
31                     0                     0                     0
32                     0                     0                     0
   regionD:hovedinttrygd regionE:hovedinttrygd regionF:hovedinttrygd
1                      0                     0                     0
2                      0                     0                     0
3                      0                     0                     0
4                      0                     0                     0
5                      0                     0                     0
6                      0                     0                     0
7                      0                     0                     0
8                      0                     0                     0
9                      0                     0                     0
10                     0                     0                     0
11                     0                     0                     0
12                     0                     0                     0
13                     0                     0                     0
14                     0                     0                     0
15                     0                     0                     0
16                     0                     0                     0
17                     0                     0                     0
18                     0                     0                     0
19                     0                     0                     0
20                     0                     0                     0
21                     0                     0                     0
22                     0                     0                     0
23                     0                     0                     0
24                     0                     0                     0
25                     0                     0                     0
26                     0                     0                     0
27                     0                     0                     0
28                     1                     0                     0
29                     0                     1                     0
30                     0                     0                     1
31                     0                     0                     0
32                     0                     0                     0
   regionG:hovedinttrygd regionH:hovedinttrygd
1                      0                     0
2                      0                     0
3                      0                     0
4                      0                     0
5                      0                     0
6                      0                     0
7                      0                     0
8                      0                     0
9                      0                     0
10                     0                     0
11                     0                     0
12                     0                     0
13                     0                     0
14                     0                     0
15                     0                     0
16                     0                     0
17                     0                     0
18                     0                     0
19                     0                     0
20                     0                     0
21                     0                     0
22                     0                     0
23                     0                     0
24                     0                     0
25                     0                     0
26                     0                     0
27                     0                     0
28                     0                     0
29                     0                     0
30                     0                     0
31                     1                     0
32                     0                     1
attr(,"assign")
 [1] 0 1 1 1 1 1 1 1 1 2 2 2 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3
[39] 3 3 3 3 3 3 3
attr(,"contrasts")
attr(,"contrasts")$region
[1] "contr.treatment"

attr(,"contrasts")$hovedint
[1] "contr.treatment"

SmallCountRounding documentation built on May 2, 2019, 8:33 a.m.