Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: RE: Graph matrix with non-linear regression lines


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: RE: Graph matrix with non-linear regression lines
Date   Thu, 12 Jun 2003 22:22:23 +0100

> 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 

The two graphics commands should be 

	if `touse' 

to be compatible with the syntax. 

Nick 
n.j.cox@durham.ac.uk 
*
*   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/



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