Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: AW: RE: Line plot for subjects in follow-up study


From   "Martin Weiss" <martin.weiss1@gmx.de>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: AW: RE: Line plot for subjects in follow-up study
Date   Fri, 16 Apr 2010 09:51:51 +0200

<> 

" This could be prettied up, and no doubt there are other ways."


You can also run the UCLA code as it is, but with -version 8.2- prepended.


HTH
Martin


-----Ursprüngliche Nachricht-----
Von: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] Im Auftrag von Philip Ryan
Gesendet: Freitag, 16. April 2010 02:04
An: statalist@hsphsun2.harvard.edu
Betreff: st: RE: Line plot for subjects in follow-up study

The code at the UCLA site appears to be for earlier versions of Stata.

Nevertheless, it will still work if you edit the two asterisked lines to
reflect the newer date handling syntax:

==========
clear
input subj tp censored str11 datestr
1 1 0 "1 jan 1990"
1 2 0 "1 mar 1991"
2 1 1 "1 feb 1990"
2 2 1 "1 feb 1991"
3 1 1 "1 jun 1990"
3 2 1 "31 dec 1991"
4 1 0 "1 sep 1990"
4 2 0 "1 apr 1991"
end

gen date = date(datestr, "DMY")    ***  "dmy" replaced with "DMY"
format date %td                    ***  %dmy replaced with %td
=============


The graph produced by the subsequent -hilite- command will be rendered in
the old gr7 format.

One way to accomplish the same sort of thing in modern Stata is:

==========
graph twoway (line subj date, con(L)) ///
(scatter subj date if cens==1, msymb(X)) ///
(scatter subj date if cens==0, msymb(o)) , legend(off)
==========

This could be prettied up, and no doubt there are other ways.


Philip Ryan
University of Adelaide 
South Australia

-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Hugh Robinson
Sent: Friday, 16 April 2010 8:51 AM
To: statalist@hsphsun2.harvard.edu
Subject: st: Line plot for subjects in follow-up study

I would like to show the staggered entry of my study subjects (on the
y-axis) against date (on the x-axis).  The y-axis would be each individual
subject with a horizontal line representing their follow-up period.

Essentially I'm trying to recreate a line plot similar to Fig 1.1 of Hosmer,
Lemeshow, and May (2008) Applied Survival Analysis.  
The same graph is presented on the UCLA stata website using the command
hilite however the code from UCLA doesn't seem to work in stata 11.
http://www.ats.ucla.edu/stat/stata/seminars/stata_survival/default.htm 

Any idea?


Hugh S Robinson Ph.D.
Postdoctoral Researcher
Montana Cooperative Wildlife
Research Unit
University of Montana
Missoula, MT 59812
Ph. (406) 243-2476


*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index