
Univariate pattern identification for dyadic Markov chains
Source:R/apim-univariate.R
univariatePattern.RdComputes empirical transition counts, estimates transition probabilities by maximum likelihood, and performs likelihood-ratio tests against the actor-only and partner-only constrained models to identify the univariate pattern of interaction.
Arguments
- chainFM
Numeric vector of observed states for the first member (FM). Values must be integers. Must have the same length as
chainSM.- chainSM
Numeric vector of observed states for the second member (SM). Values must be integers. Must have the same length as
chainFM.- states
A single integer >= 2 giving the number of states.
- alpha
A single number in (0, 1) giving the significance level. Default is 0.05.
Value
A list with class c("dyadic_pattern", "list") containing two
htest objects (TEST.AM, TEST.PM), the retained input
sequences chainFM and chainSM, a string pattern, and
metadata fields alpha, states, and call. It remains
usable as an ordinary list.
Details
The nested full/restricted comparisons form the univariate
likelihood-ratio test (LRT) procedure. dyadicMarkov evaluates each LRT
comparison using Pearson's chi-squared statistic,
$$X^2 = \sum_{ij} (O_{ij} - E_{ij})^2 / E_{ij},$$
where \(O\) and \(E\) are the empirical and theoretical transition
counts. A comparison is treated as rejected when \(p \leq \alpha\).
Pattern labels summarize which structure is retained by the tests:
IM (A0) denotes an independence pattern, APM (A1) an
actor-partner pattern, AM (A2) an actor-only pattern, and
PM (A3) a partner-only pattern.