Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
st: AW: RE: RE: RE: RE: RE: RE: RE: AW: xtline, xtline2 and cmissing(n)
From
"Martin Weiss" <[email protected]>
To
<[email protected]>
Subject
st: AW: RE: RE: RE: RE: RE: RE: RE: AW: xtline, xtline2 and cmissing(n)
Date
Mon, 17 May 2010 14:52:31 +0200
<>
So, Giovanni, Nick`s proposal could be implemented (I imagine) as:
*************
clear*
vers 10.1
set obs 4
gen id=_n
expand 10
bys id: gen time=_n
gen x=runiform()
xtset id time
replace x=. if runiform()<.3
separate x, by(id)
local opts cmissing(n)
tw (line x1 time,`opts') (line x2 time,`opts') /*
*/ (line x3 time,`opts') (line x4 time,`opts')
*************
-recast()-ing to -line- as I did in one of my earlier posts was of course
asinine, as the thing already was a -line- graph by default.
HTH
Martin
-----Ursprüngliche Nachricht-----
Von: [email protected]
[mailto:[email protected]] Im Auftrag von Nick Cox
Gesendet: Montag, 17. Mai 2010 14:39
An: [email protected]
Betreff: st: RE: RE: RE: RE: RE: RE: RE: AW: xtline, xtline2 and cmissing(n)
Martin has a solution here. But -xtline*- have rationale largely as
convenience wrappers. Having to type that specification once for every
panel is a bit awkward. (I do know that a wrapper programming that -- a
metawrapper? -- is possible.)
Using -separate- before a direct call to -twoway line- still looks a
competitor.
Nick
[email protected]
Martin Weiss
Last word on this issue from my side: I showed earlier how the -overlay-
variant of -xtline- requires -plot#opts()- specifications, which do
accept
the -cmissing()- option. This seems to work just fine in 10.1. -help
xtline-
does not promise to accept your syntax. -overlay()- only honours
-overlaid_options-...
***********
clear*
vers 10.1
set obs 4
gen id=_n
expand 10
bys id: gen time=_n
gen x=runiform()
xtset id time
replace x=. if runiform()<.3
local opts cmissing(n)
xtline2 x, overlay plot1opts(`opts') plot2opts(`opts') /*
*/ plot3opts(`opts') plot4opts(`opts')
***********
Giovanni Vecchi
Martin
to make ma point clear, I'll build on your example:
**************
clear
vers 11
set obs 4
gen id=_n
expand 10
bys id: gen time=_n
gen x=runiform()
xtset id time
replace x=. if runiform()<.3
xtline x, overlay cmissing(n) name(mygr, replace)
**************
the last line returns an error message. the two options -cmissing(n)-
and
-overlay- do not seem to get along.
-xtline2- suffers from the same problem. Following up on the above
example:
**************
version 10.1
xtline2 x, overlay cmissing(n) name(mygr, replace)
**************
returns the same error message.
My conclusion is that there is a problem with -xtline- in need of
consideration.
Personally, I also do not like to be forced to switch between -xtline-
and
-xtline2-, depending on the Stata version I am (or my co-author is)
using.
*
* 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/