Bookmark and Share

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: RE: AW: RE: AW: RE: RE: RE: RE: RE: RE: RE: AW: xtline, xtline2 and cmissing(n)


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   st: RE: AW: RE: AW: RE: RE: RE: RE: RE: RE: RE: AW: xtline, xtline2 and cmissing(n)
Date   Mon, 17 May 2010 15:22:18 +0100

This is a (good) question for StataCorp. 

(I almost never look at dialog boxes. I look at help and code.) 

Nick 
[email protected] 


-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Martin Weiss
Sent: 17 May 2010 15:11
To: [email protected]
Subject: st: AW: RE: AW: RE: RE: RE: RE: RE: RE: RE: AW: xtline, xtline2 and cmissing(n)


<> 

" There is no point in overlaying graphs when a single graph can be
drawn."


Would you be able to tell from the dialog box that a -varlist- can be passed
to -line-? I could not. The dropdown seems to be able to handle -varname-s
exclusively...



HTH
Martin


-----Ursprüngliche Nachricht-----
Von: [email protected]
[mailto:[email protected]] Im Auftrag von Nick Cox
Gesendet: Montag, 17. Mai 2010 16:03
An: [email protected]
Betreff: st: RE: AW: RE: RE: RE: RE: RE: RE: RE: AW: xtline, xtline2 and
cmissing(n)

Not quite. My allusion was to

<http://www.hsph.harvard.edu/cgi-bin/lwgate/STATALIST/archives/statalist
.1005/date/article-766.html> 

which offered the recipe 

separate response, by(panelid) veryshortlabel 
local vars `r(varlist)' 
twoway connected `vars' time, cmissing(n ..) 

A modification of your example is 

clear
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) veryshortlabel 
local vars `r(varlist)' 
tw connected `vars' time, cmissing(n ..) 
more
tw line `vars' time, cmissing(n ..) 

What are the differences? 

1. The option -veryshortlabel- with -separate- is better for graph
purposes. This was "documented" within 

SJ-5-4  gr0023  . . . . Stata tip 27: Classifying data points on scatter
plots
        . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  N.
J. Cox
        Q4/05   SJ 5(4):604--606                                 (no
commands)
        tips for using separate, gray-scale gradation, and text
        characters as class symbols to classify data points on
        a scatter plot

2. There is no point in overlaying graphs when a single graph can be
drawn. 

3. -twoway connected- has the advantage over -twoway line- that isolated
data points are shown clearly. 

Nick 
[email protected] 


Martin Weiss
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.

Nick Cox

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/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index