M.fct {cta}R Documentation

Marginalizing Matrix Based on Strata Information

Description

Creates the marginalizing matrix M using strata information found in input variable strata. That is, Mp gives the marginal probabilities corresponding to the levels of factor strata.

Usage

M.fct(strata, ncells = length(strata))

Arguments

strata

The vector that gives the stratum membership identifier.

ncells

Number of contingency table cells. Default: ncells = length(strata).

Value

M.fct returns the marginalizing matrix M.

Note

Marginals are ordered according to the levels of factor strata.

Examples:

V1 V2 y
b yes 15
a no 12
a yes 13
b yes 5
b no 1

M1 <- M.fct(V1)
M1 %*% y

[,1]
a 25
b 21

M2 <- M.fct(V2)
M2 %*% y

[,1]
no 13
yes 33

M12 <- M.fct(paste(V1, V2))
M12 %*% y

[,1]
a no 12
a yes 13
b no 1
b yes 20

Author(s)

Joseph B. Lang

References

Lang, J. B. (2004) Multinomial-Poisson homogeneous models for contingency tables, Annals of Statistics, 32, 340–383.

Examples

M.fct(rep(1, 9))
M.fct(seq(1, 9))
M.fct(c(1, 1, 2, 3, 3))

[Package cta version 1.3.0 Index]