Type of Tool  RFunction 
Title  ScatterW Slope 
Programmer/Email  SallyThurston 
Contributing Site  Rochester 
Description  The function shows adjusted and/or unadjusted regression lines (optionally with confidence bands) superimposed on a scatterplot of the raw data. The adjusted line shows the predicted line at mean values of all variables in the ``covnames'' arguments. There is considerable flexibility to tailor the plot, including: whether to show adjusted or unadjusted regression lines (or both), with or without confidence bands, whether to include a legend (and the legend location), the plotting symbols and size, title and size, color of lines, whether to print unadjusted and adjusted regression coefficients, and whether to save the plot in a file (if so, as a pdf or eps file). 
Example  Example code and example graphic 
Classification Graph Type  Other, Survival Plot 
Graph_Type 

References 

Datasets  Other 
Data  airquality data available in R 
Software Program  R 
Software  R version 2.9.0 (20090417) 
Macro Parameters 
### ARGUMENTS: ### tdat is database ### yname is name of y variable in tdat ### xname is name of x variable in tdat ### covnames is vector of names of remaining variables ### txlab is name to go on xaxis of plot ### tylab is name to go on yaxis of plot ### adjusted=TRUE if want adjusted line ### unadjusted=TRUE if want unadjusted line (note: can show both adjusted and unadjusted) ### col.adj=color to show adjusted regression line (and associated legend) ### col.unadj=color to show unadjusted regression line (and associated legend) ### conf.bands.adj=TRUE if want confidence band for adjusted regression lines ### conf.bands.unadj=TRUE if want confidence band for unadjusted regression lines ### cex.xylab=size of x and y axis labels ### pch.points=plotting character for the points (pch.points=1 is circles) ### cex.points=size of points ### ### (Next arguments apply to optional checks) ### print.results=TRUE means the program will output the sample size and regression summary ### check.line=TRUE means to also show (overlay) the regression line using the abline command ### (in addition to line using predict command: normally this should be FALSE) ### (For the adjusted line, will not be the same unless covnames are centered.) ### ### (Next arguments apply to the case when user wants to save the file) ### save.plots=TRUE means the user wants to create a file of the plot ### type.plots="eps" or "pdf" are the two options if save.plots=TRUE ### basename.plot=base name of the file, e.g. basename.plot=silly and type.plots="pdf" will create silly.pdf ### ### (Next arguments apply to legend showing slope and pvalue) ### show.legend=TRUE means put slope and pvalue on plot ### legend.loc=location of legend ### cex.legend=size of legend ### round.slope=n means to round slope in legend to n digits (default=2) 
RCode  Attachment  Thurston_RCode_File Scatter W Slope 
RCode 

SASCode  Attachment 

SASCode 

StataCode  Attachment 

StataCode 

Other Code  Attachment 

Other Code 

Called Data Manipulation 

Called Tool/Utility 

Called Checking Macro 

Called Other 

CreationDate  February 13, 2012 
RevisionDate 

Example Code  R Example Code 
Example Output  R Example Output 
SAS Examples 

SAS_Example_Code 

SAS_Example_Output 

R Examples 

R_Example_Code 
Sweave example code for scatterWslope.R pdf file from Sweave example code 
R_Example_Output 
Example R code for demonstration of scatterWslope.R pdf file of plot made by scatterWslopeExample.R 
Stats Examples 

Special Features 

Special Features Attached 

Special Features Text 

Notes1Legend  Section with calls to needed macros 
Notes1 

Notes2Legend  Macro call with fully specified parameters 
Notes2 

Notes3Legend  Section with definitions of global macro parameters 
Notes3 

Notes4Legend  Section with definitions of local macro variables 
Notes4 

See Also 

Checklists 

Stat Tools Disclaimer 

Discliamer 
The views expressed within CTSpedia are those of the author and must not be taken to represent policy or guidance on the behalf of any organization or institution with which the author is affiliated. 
Permission 
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF ERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT OLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 
Reference Image 
