# st: RE: XTTRANS: discrepancies in the number of observations

 From "Nick Cox" To Subject st: RE: XTTRANS: discrepancies in the number of observations Date Thu, 15 Jun 2006 08:55:35 +0100

```The reasons for discrepancies may include

boundary conditions: there is no observation
before the first, and none after the last

gaps

and

missing values

In particular, you need to understand the difference
between the last two categories. If I have an obs
at t = 1 and the next is at t = 3, then I have a
gap at t = 2. This is not the same as having an
obs at t = 2, but an explicit missing value.

Nick
n.j.cox@durham.ac.uk

Carol Bao

> I have a panel data and using XTTRANS command I get a
> matrix as follows:
>
>            |                   stat
>       stat |         0          1          2
> 3 |     Total
> -----------+--------------------------------------------+----------
>          0 |       843      1,989        139
> 126 |     3,097
>            |     27.22      64.22       4.49
> 4.07 |    100.00
> -----------+--------------------------------------------+----------
>          1 |     1,294     13,259      1,987
> 867 |    17,407
>            |      7.43      76.17      11.41
> 4.98 |    100.00
> -----------+--------------------------------------------+----------
>          2 |        99      1,547      1,271
> 834 |     3,751
>            |      2.64      41.24      33.88
> 22.23 |    100.00
> -----------+--------------------------------------------+----------
>          3 |       127        837        693
> 2,155 |     3,812
>            |      3.33      21.96      18.18
> 56.53 |    100.00
> -----------+--------------------------------------------+----------
>      Total |     2,363     17,632      4,090
> 3,982 |    28,067
>            |      8.42      62.82      14.57
> 14.19 |    100.00
>
> First of all, the total number of observations here,
> 28067 is not the same as (fewer than) the number of
> observations for the sample if I do .sum.  Also, if I
> do:
>
> . tab stat if lag==0;
>
>        stat |      Freq.     Percent        Cum.
> ------------+-----------------------------------
>           0 |        946       27.59       27.59
>           1 |      2,174       63.40       90.99
>           2 |        166        4.84       95.83
>           3 |        143        4.17      100.00
> ------------+-----------------------------------
>       Total |      3,429      100.00
>
> The number of observations don't equal to the
> corresponding ones in the first row of the matrix
> either.
>
> I really appreciate it if anyone could kindly give me
> some information or tips as to what I am missing here.
> Each person has only one spell of observations on STAT
> in the sample, though the numbers of observations per
> spell diff.

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/
```