> -----Original Message-----
> From: Neil Shephard [mailto:[email protected]]
> Sent: Monday, August 19, 2002 9:51 AM
> To: [email protected]
> Subject: st: help with tables
>
>
> Hi all,
>
> I was wondering if anyone knows of an .ado file that might solve the
> problem I have.
>
> My dataset consists of LOD scores from whole genome screens,
> and I have carried out analysis on various stratifications of the
> whole data set.
>
> I would like to produce a table that gives the maximum LOD score
> on each chromosome for each replicate, with the position of that
> LOD score. I can achieve the first part of this using
>
> -table chr strat, c(max lod)-
>
> which produces
>
> ------------------------------------------
> Chrom | strat
> | 0 1 2
> -------------+-------------------------------
> Chr01 | 1.021457 .744813 1.516707
> Chr02 | .484565 .526793 .633966
> Chr03 | .582743 1.079223 .228413
> Chr04 | .515382 1.269104 .107555
> Chr05 | .290357 .15492 .935334
> Chr06 | 3.610746 6.724064 .210437
> Chr07 | .658136 .859743 .266631
> Chr08 | .460963 .786725 .294109
> Chr09 | .47856 .520341 .121645
> Chr10 | .673608 .62035 1.421104
> Chr11 | .100738 .555981 .933838
> .
> .
>
>
> however I can't work out how to include the pos(ition) that
> corresponds to each of the maximum LOD scores. None of the
> clist arguments seem to allow for this.
>
> I've tried a few different -findit- searches but nothing
> obvious stuck
> out, I'd be grateful for any suggestions.
>
> Thanks in advance
>
> Neil
There may be a fancier way, but one way is to first flag the relevant
observation(s), then table only those:
egen double ismax = max(lod) , by(chr strat)
replace ismax = lod==ismax
table chr strat if ismax==1, c(mean lod mean pos n pos)
The first line simply generates a variable with the maximum lod within
chr and strat; then the next line converts this to a 1/0 variable that
flags the maximum. The final line tables only the maximum observations,
listing the mean lod and mean pos. Note the inclusion also of the
number of maximum observations; this will tip you off if there is more
than one that takes on the maximum value, in which case you might want
to examine more closely.
Nick Winter
*
* 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/