Help of ^unfold^ : Program to unfold or unblock data sets
--------------------------------------------------------
Joseph Hilbe, Editor STB


The syntax for ^unfold^ is:

            ^unfold^  pos_var pop_var [rhsvar]

pos_var is a variable containing the number of positive responses for a 
group or block. pop_var is the total cases in a block or group. 
Right-hand-side covariates will be appropriately handled; you do not 
need to name them on the command line.  

Consider the following grouped data set:

           infec     cases     cd4     cd8
    1.       2         2        1       2
    2.       4         7        0       0
    3.       1         3        2       2
    4.       0         2        2       0

The first observation tells us that there are two cases having the values of 
1 and 2 for cd4 and cd8 respectively. Moreover, both of these  
cases have a positive response (i.e. infection occurs). The second 
observation represents a group consisting of four positive responses 
out of seven cases for a covariate pattern of 0 0.

^unfold^ literally unfolds or ungroups a data set. In order to do this 
two new variables are created.


^. unfold infec cases
Blocked data set unfolded...

^.l

      infec     cases     cd4     cd8     _infec     _cases
1.      2         2        1       2          0          0
2.      4         7        0       0          0          3
3.      1         3        2       2          0          2 
4.      0         2        2       0          0          2
5.      2         2        1       2          1          2
6.      4         7        0       0          1          4
7.      1         3        2       2          1          1
8.      0         2        2       0          1          0


Notice that the first observation, having a covariate pattern of 1 2, shows 
no cases with a non-positive outcome. Observation 5, having the same pattern,
records two positive responses (infections). This accords with what we saw 
in the grouped format. Also notice that the newly created variables of 
interest have the same name as the original grouped variables, except that 
they have a leading underscore. Although the original variable could have 
been discarded in the transformation, I decided to retain them in the 
ungrouped data set in case a user may find them valuable. However, they are 
not needed for most subsequent analysis.

Remember, when performing subsequent analysis, ^_cases^ is a frequency 
weight. Hence, a logistic regression of the above data set would look like:

            ^logistic^ _infec cd4 cd8 [fw=_cases]

Of course, you may rename the underscored variables to anything you
like. Refer to ^sqv4^ for use with blocked logistic regression.

