getBurt {cabootcrs}R Documentation

Converting a data matrix into a Burt matrix

Description

getBurt recodes a data matrix from one format (n objects by p variables, counts for distinct combinations of p variables, contingency table) into a Burt matrix, or extracts a subset of a Burt matrix for selected variables

Usage

getBurt(
  Xinput,
  input = "nbyp",
  Jk = NULL,
  maxcat = NULL,
  varandcat = TRUE,
  vars = NULL
)

Arguments

Xinput

A data matrix, in the form of a data frame or similar

input

The format of the input matrix:

"nbyp"

An n individuals/objects/data points by p categorical variables matrix, where each row is a different data point and each column contains the category for that data point on that variable, where these categories can be numbers, strings or factors

"nbypcounts"

Similar to the above, but each row represents all of the data points taking the same combination of categories, and the first column contains the count for this combination (hence the name used here is a bit of a misnomer, but it emphasises the similarities to an n by p)

"indicator"

An indicator matrix, similar to the n by p matrix except that a variable with J_k categories is represented by J_k columns and a data point taking the i-th category has 1 in the i-th of these columns and a zero in the others

"Burt"

A Burt matrix, symmetrical and block-diagonal with each block being a contingency table for a pair of variables

Jk

See convert

maxcat

See convert

varandcat

See convert

vars

A list of the variable numbers to be used in the Burt matrix, if only a subset is wanted.
If not all variables are wanted and the input is not n by p then Jk must be specified.

Value

A Burt matrix, symmetrical and block-diagonal with each block being a contingency table for a pair of variables

See Also

Other conversion functions: convert(), getCT(), getdoubled(), getindicator()

Examples

nishburt <- getBurt(NishData)
nishburtvars1to3 <- getBurt(NishData,vars=1:3)
nishburtvars2and4 <- getBurt(nishburt,input="Burt",Jk=rep(3,4),vars=c(2,4))


[Package cabootcrs version 2.1.0 Index]