R-Functions with Outputs

Return to Statistical Tools Home

Title Programmer/Email R Code Sample Run Macro Parameters
ScatterW Interaction SallyThurston thurston@bst.rochester.edu     ### ARGUMENTS:
### tdat is database
### yname is name of y variable in tdat
### xname is name of x variable in tdat, for which we want partial plot
### dummyvar is name of dummy variable for which we want interaction
### x0name is name of x*I(dummy variable==0) (THIS MUST BE PART OF THE DATASET)
### x1name is name of x*I(dummy variable==1) (THIS MUST BE PART OF THE DATASET)
### covnames is vector of names of remaining variables
### txlab is name to go on x-axis of plot (default is xname)
### tylab is name to go on y-axis of plot (default is yname)
### cex.xylab is size of x and y axes
### ttitle is title of plot (default is none)
### cex.title is size of title
### print.results=TRUE if want to print regression results on screen
###
### show.legend=TRUE means include legend
### legend.x0name is what to go in the legend to indicate slope for x0
### legend.x1name is what to go in the legend to indicate slope for x1
### legend.loc is location of legend. Possible values are:
### "topleft","topright","bottomleft","bottomright","top","bottom","left","right","center"
### cex.legend is size of legend
###
### confidence.bands=TRUE if want confidence bands on the plot
### lty.lev0 is line type for plotting the line for dummy=0
### lty.lev1 is line type for plotting the line for dummy=1
### lty.confidence is line type for the confidence interval
### col.lev0 is color for points and line for dummy=0
### col.lev1 is color for points and line for dummy=1
### pch.lev0 is plotting character for dummy=0
### pch.lev1 is plotting character for dummy=1
### cex.points is size of points
###
### lwd.slope is lwd for slopes
### lwd.confidence is lwd for confidence bands
###
### The user has the option to either view the plots on the screen
### (save.plots=FALSE, which is the default), or to save the plots
### (save.plots=TRUE)
### If save.plots=TRUE, save either to pdf files (type.plots="pdf", the default)
### or as eps files (type.plots="eps"). The user controls the base name
### of the plots with the basename= argument, so if basename=silly and
### type.plots="pdf" then the plots will be silly1.pdf, silly2.pdf, etc.
###
### ndigits is number of digits to show when printing regression model
ScatterW Slope SallyThurston Thurston_R-Code_File Scatter W Slope   ### 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 x-axis of plot
### tylab is name to go on y-axis 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 p-value)
### show.legend=TRUE means put slope and p-value 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)
Kappa R Yan Ma Rochester_Kappa Statistics_R Function   The required parameters (n, g, t, x, y, weight):

1. n=Number of subjects
2. g=Number of categories
3. t= Number of time points
4. x Matrix for the first rater\x92s ratings, where element x(i,j) represents the rater\x92s rating on the ith subject at time j   
5.   y =Matrix for the second rater\x92s ratings, where element y(i,j) represents the rater\x92s rating on the ith subject at time j
6.   Weight=Indicator of weight. Where weight=1 for unweighted kappa; weith
2 for Cicchetti-Allison weighted kappa; weight=3 for Fleiss-Cohen weighted kappa.

Mann Whitney Wilcoxon R Rui Chen Rochester_MMW Longitudinal_R Function   dataset
Multivariate Partial Least Squares (R) Danh Nguyen Davis_Partial Least Squares_R Function   Input argument(s)
X_s Matrix of predictors (genes)--standardized to mean 0 variance 1
variance 1 ("training X" of size n x p).
Y_s Matrix (or vector) of responses Y_s--also standardized
("training Y" of size nxL).
X_ps Matrix of predictor values (test/validation X) to construct
test components, X_ps (of size mxp).
lv The number of PLS components (lv).

Return(s):
T1 n x lv matrix of PLS training components based on training
information.
T2 m x lv matrix of PLS test components contructed from training
information.
PVEX 1 x lv vector of cummulative percent of X-variation explained.
PVEY 1 x lv vector of cummulative percent of Y-variation explained.
W p x lv matrix of X-weights.
B p x 1 vector of "regression coefficients".
V p x 1 vector of linear combination of sum of squares of X-weights
This is the so called 'VIP' (variable influence on projection)
(Wold 1994; SAS Institue Inc., 1999).

Summarize R Macro SallyThurston Rochester_Summarize R_Function   For (1) lookup: colname (column name of a dataframe), longnames (vector of longer variable names, where the name of longnames should include colname)

For (2) summarize:
### REQUIRED arguments are:
### tmat = dataframe containing variable for which we want a summary
### OPTIONAL arguments are:
### digits = number of digits to show in the summary
### quants = quantiles to be included. Default is c(0,.25,.5,.75,1)
### If don't want quantiles, make quants=NULL
### latex = TRUE if want output in LaTeX
### full.latex = TRUE if want latex output to be a stand-alone
### LaTeX file. If latex=TRUE and full.latex=FALSE, the
### output can be included with an \include{filename} command.
### (may be useful if output from this function will be
### included as one part of a larger set of function calls.)
### SD = TRUE if want to show SD
### nmis = TRUE if want to show number missing observations
### uniq = TRUE if want to show number of categories
### lookup.names = vector of longer variable names, where column names
### should match variable names in tmat
### filename = name of file where output should be saved
### (default is NULL, not to save it to a file)
### screen = TRUE if want to view results on the screen
### caption = caption for LaTeX format
U_ICC.R Dr. Naiji Lu     (n,t,y)
n=number of subjects
t=number of time points
y is the data
Variance Smoothing of Fully Moderated t-statistic Lianbo Yu fmt.R   Amean: vector of residual variances of all genes.
df: degrees of freedom for sigmasq.
span1: span parameter in LOESS smoothing function.
span2: span parameter in LOESS smoothing function.
iter1: iteration number in LOESS smoothing function.
iter2: iteration number in LOESS smoothing function.
b: number of genes on either side of moving average window when calculating variance of log residual variances.
Zero Inflated Poisson R Naji Lu Rochester_ZIP_R Function   The required parameters (n, noc):
1. n=Number of subjects
2. noc=Number of covariates
Number of topics: 9

Return to Statistical Tools Home