I think I might not have explained my problems clearly. I have k indicator
variables (coded as 1 or 0) and I would like to know the response patterns
(for example for latent class analsis) to these k variables. For example,
I would like to know for each response pattern, how many cases are there,
and programmed into an ado file. My key problem here is how to run through
all the combinations (univariate, bivariate, and trivariate)
One posibility is that I used the following cods (or reviced version to fit
into an ado file)
******************************************************************
clear
for num 1/6: set obs 100\ gen xX=invnorm(uniform()) \ gen DxX=xX>0.6
gen pattern=0
local i=1
while `i'<6 {
replace pattern=pattern+Dx`i'*10^(6-`i')
local i=`i'+1
}
aorder
list Dx1-Dx6 pattern
sort pattern
list pattern
gen count=1
collapse (sum) count, by(pattern)
***********************************************************
The resulting data matrix looks like:
Here the problem is that it only presents the response pattern that has at
least one case and it's hard to handle its order (now is list in numerical
order: from small to big)
But what if I want to go through "each" combination (2^k possible ways) in a
sysmatic way and list all response pattern freqeuncy though some of them
have zero cases. What I meant by a systematic way is like:
Here I didn't present some summarize command that could grab case number for
that response pattern. But basically I will run through each combination
and calculate the frequency for that particular combination though there
might be zero cases. Thanks a lot
Jun Xu
Department of Sociology
Indiana University at Bloomington