Learn R Programming

cta (version 1.3.0)

check.homog: \(Z\) Homogeneity Check

Description

Checks whether the constraint function \(h(\cdot)\) satisfies a necessary condition for \(Z\) homogeneity.

Usage

check.homog(h.fct, Z, tol = NULL)

Arguments

h.fct

An R function object, indicating the constraint function \(h(\cdot)\) for \(Z\) homogeneity check.

Z

Population (aka strata) matrix \(Z\).

tol

The pre-set tolerance with which norm(diff) is to be compared with.

Value

check.homog returns a character string chk that states whether \(h(\cdot)\) is \(Z\) homogeneous. If chk = "", it means that based on the necessary condition, we cannot state that \(h(\cdot)\) is not \(Z\) homogeneous.

Details

The main idea:

\(h(\cdot)\) is \(Z\) homogeneous if \(h(Diag(Z\gamma)x) = G(\gamma)h(x)\), where \(G\) is a diagonal matrix with \(\gamma\) elements raised to some power.

As a check, if \(h(\cdot)\) is homogeneous then $$h(Diag(Z\gamma) x_{1}) / h(Diag(Z\gamma) x_{2}) = h(x_{1}) / h(x_{2});$$ That is, $$\texttt{diff} = h(Diag(Z\gamma) x_{1}) h(x_{2}) - h(Diag(Z\gamma) x_{2}) h(x_{1}) = 0.$$ Here, the division and multiplication are taken element-wise.

This program randomly generates gamma, x1, and x2, and computes norm(diff). It returns a warning if norm(diff) is too far from \(0\).

References

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

See Also

check.zero.order.homog, mph.fit, check.HLP

Examples

Run this code
# NOT RUN {
# EXAMPLE 1
h.fct <- function(m) {m[1] - m[2]}
Z <- matrix(c(1, 1), nrow = 2)
check.homog(h.fct, Z)

# EXAMPLE 2
h.fct.2 <- function(m) {m[1]^2 - m[2]}
Z <- matrix(c(1, 1), nrow = 2)
check.homog(h.fct.2, Z)
# }

Run the code above in your browser using DataLab