merge_Q: merge Q matrix by rows

Description Usage Arguments Value Examples

Description

Some rows of Q correspond to partner factors that are present or absent together; It is of scientific interest to combine them by taking the maximum for each column of Q among these rows.

Usage

1
merge_Q(Q, map_id)

Arguments

Q

A Q matrix (row for ACTIVE factors that might be partners, columns for dimension of multivariate binary data)

map_id

a vector taking possibly duplicated values in 1,...,M^+, where M^+ is the number of active factors. map_id=c(1,1,2,2,2,3) means factor 1 and 2 are partner factors, factor 3 to 5 are another group of partner factors.

Value

A Q matrix with merged rows (by taking maximum within each group of partner factors) NB: does this work for other restricted LCM models? (DINO - ok; what about two latent states that never co-exist? DINA - okay by duality. For general RLCM, the log-linear representation will only have q_jk*q_jk', after merging, the term will be q_jk”, where k” is merged version of k and k'. The population model will be find because if there is no person with k or k' only, the parameter for q_jk or q_jk' alone could not be estimated - no differentials in response probability levels.)

Examples

1
2
3
4
5
6
Q <- simulate_Q(6,100,0.1)
map_id <- c(1,1,2,2,3,2)
Q_merge <- merge_Q(Q,map_id)
par(mfrow=c(1,2))
image(Q,main="before merging")
image(Q_merge, main="after merging")

oslerinhealth/rewind documentation built on May 26, 2021, 6:56 a.m.