Nick
I like your program. Was it your idea to use the diagonal for
percentile plots? If so it is a clever use of this space.
Bill
-----Original Message-----
From: Nick Cox [mailto:[email protected]]
Sent: Thursday, June 12, 2003 1:21 PM
To: [email protected]
Subject: st: RE: Graph matrix with non-linear regression lines
Bill Dupont
> In version 7, the -matrix- and -band- options of the graph
> command gave
> matrix graphs with a non-linear regression line added to
> each scatter
> plot. These regression lines appear to be unavailable in
> the version 8
> graph matrix command. Assuming I have not misread the
> manual, what are
> listers thoughts on the utility of these regression lines on matrix
> plots? What were Stata's reasons for dropping this option?
> I thought it was useful.
-band()- showed conditional group medians.
That's, I guess, a kind of L_1 regression.
As you're polling, I hadn't noticed it had gone,
despite using -graph matrix- quite a lot, so
that's lukewarm at best.
Why has it gone is a question for Stata Corp,
but I note that -graph matrix- is in essence
a matrix of -scatter-. In principle, there
are all sorts of graphs which can be put into
a matrix, and while we're waiting for Stata
Corp to give us some easy handles for that,
a challenge is to see how far one can
get.
Below my signature is an example. This
is just -my- -graph- -matrix- on 12 June. I
decided to put quantile plots on the diagonal,
and I prefer -lowess-, but the idea can
be varied fairly easily.
Nick
[email protected]
P.S. it's slow. (OK, now don't start that one again.)
program mygraphmatrix
*! NJC 1.0.0 12 June 2003
version 8
syntax varlist(numeric) [if] [in] [, * ]
marksample touse
qui count if `touse'
if r(N) == 0 error 2000
set graphics off
qui foreach y of local varlist {
local ny = 1
foreach x of local varlist {
tempname f
if `ny' > 1 {
local yt
}
else {
local yt : variable label `y'
if `"`yt'"' == "" local yt "`y'"
}
if "`x'" == "`y'" {
quantile `x', yti("`yt'")
saving(`f'.gph)
}
else {
lowess `y' `x', title("") note("") ///
legend(off) ///
yti(`"`yt'"') saving(`f'.gph) `options'
}
local files `"`files' "`f'""'
local FILES "`FILES' `f'.gph"
local ny = `ny' + 1
}
}
set graphics on
graph combine `files', imargin(zero)
foreach F in `FILES' {
erase `F'
}
end
*
* 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/
*
* 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/