Description Usage Arguments Details Value Author(s) References See Also Examples

Returns hierarchical model constraint matrix, i.e., nullspace of design matrix

1 | ```
ConstraintMatrix(var, suffconfigs, dim, SubsetCoding = "Automatic")
``` |

`var` |
character or numeric vector containing variables |

`suffconfigs` |
subvector or list of subvectors of |

`dim` |
numeric vector indicating the dimension of |

`SubsetCoding` |
allows a (character) type or a matrix to be assigned to variables for each element of |

, see examples

The model *mu_ij = alpha + beta_i + gamma_j*
has parametric form and can equivalently be described using constraints on the *mu_ij*,
by *mu_ij - mu_il - mu_kj + mu_kl = 0*.
Returns the transpose of the null space of `DesignMatrix(var,marg,dim)`

. Rows normally sum to zero.
See `DesignMatrix`

for more details.

matrix

W. P. Bergsma w.p.bergsma@lse.ac.uk

Bergsma, W. P. (1997).
*Marginal models for categorical data*.
Tilburg, The Netherlands: Tilburg University Press.
http://stats.lse.ac.uk/bergsma/pdf/bergsma_phdthesis.pdf

Bergsma, W. P., Croon, M. A., & Hagenaars, J. A. P. (2009). Marginal models for dependent, clustered, and longitudunal categorical data. Berlin: Springer.

`ConstraintMatrix`

, `DesignMatrix`

, `DirectSum`

, `MarginalMatrix`

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | ```
# Constraint matrix for independence model
var <- c("A","B")
suffconfigs <- list(c("A"),c("B"))
dim <- c(3, 3)
ConstraintMatrix(var,suffconfigs,dim)
# notation in one line
ConstraintMatrix(c("A","B"),list(c("A"),c("B")),c(3,3))
# Constraint matrix for saturated model, two short specifications giving same result
ConstraintMatrix(c("A","B"),c("A","B"),c(3,3))
ConstraintMatrix(c("A","B"),list(c("A","B")),c(3,3))
# Constraint matrix for univariate quadratic regression model
var <- c("A")
suffconfigs <- c("A")
dim <- c(5)
ConstraintMatrix(var,suffconfigs,dim,SubsetCoding=list(c("A"),"Quadratic"))
# notation in one line
ConstraintMatrix(c("A"),c("A"),c(5),SubsetCoding=list(c("A"),"Quadratic"))
# Constraint matrix for linear by nominal model, various methods:
# simplest method which assumes equidistant centered scores:
ConstraintMatrix(
var = c("A", "B"),
suffconfigs = c("A", "B"),
dim = c(3, 3),
SubsetCoding = list(c("A", "B"), list("Linear", "Nominal")))
# alternative specification with same result as above:
ConstraintMatrix(
var = c("A", "B"),
suffconfigs = c("A", "B"),
dim = c(3, 3),
SubsetCoding = list(c("A", "B"), list(rbind(c(-1, 0, 1)), rbind(c(1, 0, 0), c(0, 1, 0)))))
# specifying your own category scores
scores <- c(1,2,5);
ConstraintMatrix(
var = c("A", "B"),
suffconfigs = c("A", "B"),
dim = c(3, 3),
SubsetCoding = list(c("A", "B"), list(rbind(scores), "Nominal")))
# Constraint matrix for nominal by nominal model, equating parameters of
# last two categories of second variable:
ConstraintMatrix(var = c("A", "B"), suffconfigs = c("A", "B"), dim = c(3,3),
SubsetCoding = list(c("A", "B"), list("Nominal", rbind(c(1, 0, 0), c(0, 1, 1)))))
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.