RecordsToFrequencies {cmm}R Documentation

RecordsToFrequencies

Description

Converts Records (units x variables) into a frequency vector.

Usage

RecordsToFrequencies(dat, var = varDefault, dim = dimDefault, augment = "all", 
                            seed = FALSE)

Arguments

dat

matrix or dataframe containing the scores of units (rows) on categorical variables (columns)

var

character or numeric vector containing variables. By default, all variables are selected.

dim

numeric vector indicating the dimension of var. By default, the dimensions of each variable are derived from dat

augment

augmentation: determines the type of frequency vector. Select one of four options: "all" frequency vector contains all cells, "obs" frequency vector contains only observed cells (cells with at least one observation), "1k" frequency vector contains observed cells plus a selection of unobserved cells (see Van der Ark et al., 2023, for details), "2k" frequency vector contains observed cells plus a wider selection of unobserved cells (see Van der Ark et al., 2023).

seed

integer. As aug options "1k" and "2k" have a random components, a setting a will allow an exact replication of a CMM analysis when option "1k" or "2k" is used.

Value

matrix

Author(s)

W. P. Bergsma w.p.bergsma@lse.ac.uk and L. A. van der Ark L.A.vanderArk@uva.nl

References

Van der Ark, L. A., Bergsma, W. P., & Koopman L. (2023) Maximum augmented empirical likelihood estimation of categorical marginal models for large sparse contingency tables. Paper submitted for publication.

See Also

MarginalMatrix

Examples

data(acl)
dat <- acl[, 1:2] + 1                                 # select 2 items from ACL 
var <- 1 : ncol(dat)                                  # define the variables
marg <- Margins(var, c(0, 1))                         # margins are total (0) and 1st order 
dim <- rep(5, length(var))
t(RecordsToFrequencies(dat, var, dim, "obs"))         # frequency vector with observed cells
t(RecordsToFrequencies(dat, var, dim, "1k"))          # frequency vector with observed and

[Package cmm version 1.0 Index]