| rhoScale {ResearchMethods} | R Documentation |
Using a graphical user interface (GUI), this function demonstrates the effect of scaling and shifting a dataset has on its correlation, rho, and its inter-class correlation, icc, on another dataset.
rhoScale(x,y,gui=TRUE,sc=1,sh=0,xlab='x',ylab='y')
x,y |
The two variables from which the correlation is calculated, used as the x and y axes respectively in the plot. |
gui |
An indicator of whether the interface should be activated. |
sc |
The initial scaling value. |
sh |
The initial shiting value. |
xlab,ylab |
What to label the plots with. |
This function produces one or two windows. The Tk window, which only appears if gui=T produces two sliders to manipulate the plot window. Scale has a range of [0.1, 5] and is the multiplier on the x-variable, labeled a (see below). Shift has a range of 25% of the data range, about the mean, and is the shift on the x-variable, labeled b (see below).
The second window is a plotting window, featuring two scatterplots. The first, the black plot, is of the original data, of the form y = x, with a line of best fit through it. The second, the red plot, is the data shifted and scaled, of the form Y = aX + b.
No meaningful value is returned, this function is run only for its plotting functions. The variable RSenv is left behind so the variables used in the plotting function may be maniuplated.
This program was written on Ubuntu Linux 7.0.4. Though it should work on all operating systems, because of its use of Tcl/Tk it is only guarenteed on Linux. Any problems with the GUI should be checked against the Tcl/Tk documentation.
The function was designed to work with the GUI. The ability to plot without it was added to allow the function to be embedded into other programs such as Sweave. Whenever possible, it is better to use the GUI controls.
Mohamed Abdolell <mohamed.abdolell@dal.ca> and Sam Stewart <samstewart11@gmail.com>
This plot was designed for a course by Mohamed Abdolell
rhoScale
univar
# two simple examples
data("MFSV")
rhoScale(MFSV$MF,MFSV$SV)
data("agpop")
rhoScale(agpop[,6],agpop[,7])
# working without the GUI
rhoScale(MFSV$MF,MFSV$SV,gui=FALSE,sc=2,sh=25)
R version 2.9.0 (2009-04-17)
Copyright (C) 2009 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> library(ResearchMethods)
> png(filename="images/rhoScale_%03d.png" ,width=480, height=480)
> ### Name: rhoScale
> ### Title: Scaling and Shifting rho calculations
> ### Aliases: rhoScale
> ### Keywords: univar
>
> ### ** Examples
>
> # two simple examples
> data("MFSV")
> rhoScale(MFSV$MF,MFSV$SV)
> data("agpop")
> rhoScale(agpop[,6],agpop[,7])
>
> # working without the GUI
> rhoScale(MFSV$MF,MFSV$SV,gui=FALSE,sc=2,sh=25)
>
>
>
> dev.off()
null device
1
>