RcmdrPlugin HH
RcmdrPlugin HH
RcmdrPlugin HH
HH
February 15, 2013
Type Package Title Rcmdr support for the HH package Version 1.1-38 Date 2013-01-17 Author Richard M. Heiberger, with contributions from Burt Holland Maintainer Richard M. Heiberger <rmh@temple.edu> Depends car, R (>= 2.13.0), HH (>= 2.3-27), multcomp (>= 0.9917),leaps, lattice, grid, grDevices, latticeExtra Imports Rcmdr (>= 1.9-3) Suggests mgcv, abind, rgl, vcd Description Rcmdr menu support for many of the functions in the HH package. The focus is on menu items for functions we use in our introductory courses. RcmdrModels aov License GPL (>= 2) Repository CRAN Date/Publication 2013-01-23 07:04:18 NeedsCompilation no
R topics documented:
RcmdrPlugin.HH-package . . . . anovaTableI.HH . . . . . . . . . . bestSubsetsRegressionModel.HH . BoxCox . . . . . . . . . . . . . . CloseCommanderRestart . . . . . condenceIntervalsPlot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 3 4 4 5 5
2 DotplottbRcmdr . . . . . . . Interaction2wtRcmdr . . . . latticeFunctions . . . . . . . MMCmenu . . . . . . . . . normal.and.t.hypotheses.plot PlotLikertDialog . . . . . . PredictModel . . . . . . . . Projector . . . . . . . . . . . QQPlot.HH . . . . . . . . . Regr1Plot . . . . . . . . . . ResizeEtcDialog . . . . . . R_options . . . . . . . . . . Scatter3DDialog.HH . . . . scatter3dHH . . . . . . . . . scatterPlot.HH . . . . . . . . scatterPlotMatrix.HH . . . . twoWayTable.HH . . . . . . Xyplot.HH . . . . . . . . . Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
RcmdrPlugin.HH-package . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 6 7 7 8 8 9 10 10 11 11 12 12 13 16 16 17 17 19
RcmdrPlugin.HH-package Functions added to the Rcmdr package to support the introductory course at Temple University.
Description Our introductory course spends time on several topics that are not yet in the R Commander. Therefore we wrote the menu items and make them available. Details Package: Type: Version: Date: License: Rcmdr.HH Package 1.0 2006-06-02 GPL version 2 or newer?
bestSubsetsRegressionModel.HH Rcmdr interface to the regsubsets function in the leaps package. twoWayTable.HH Pearsons Chi-squared Test for Count Data (additional formats for data input) anovaTableI.HH Sequential sums of squares on the Rcmdr menu. scatter3dHH add the ability to plot squared residuals. The squared residuals have been adopted into Rcmdr. This interface offers a checkbox for a new 3D window and an option to draw a non-
anovaTableI.HH least-squares plane for pedagogical comparison. ci.plot Plot condence and prediction intervals for simple linear regression.
panel.bwplot.intermediate.hh Panel function for bwplot that give the user control over the placement of the boxes. interaction2wt Plot all main effects and twoway interactions in a multifactor design. scatterPlotMatrix.HH Similar to scatterplot.matrix The revision uses row1attop=FALSE to force the main diagonal of the scatterplot matrix to go uphill from southwest to northeast. QQPlot.HH Added Shapiro-Wilk test of normality. norm.curve Plot a normal curve with shaded rejection regions, optionally a second curve centered at an alternative hypothesis value can be plotted. Both x and z scales are displayed. Author(s) Richard M. Heiberger, with contributions from Burt Holland Maintainer: Richard M. Heiberger <rmh@temple.edu> References Heiberger, Richard M. and Holland, Burt (2004b). Statistical Analysis and Data Display: An Intermediate Course with Examples in S-Plus, R, and SAS. Springer Texts in Statistics. Springer. ISBN 0-387-40270-5. See Also Rcmdr Examples
## Not run: ## start R library(Rcmdr.HH)
## loads the package and opens the Rcmdr ## window with the HH menu
## End(Not run)
anovaTableI.HH
Description Rcmdr interface to anova function, specically to get the sequential sums of squares. Usage anovaTableI.HH() anovaTableII.HH() ## exact copy of John Foxs anovaTable from Rcmdr/R/model-menu.R
BoxCox
Description Menu interface to the Best Subsets Regression function. Selection boxes allow one response variables and one or more predictor variables. All subsets are calculated. Only the best $k$, where $k$ is menu item, are displayed. A graph displaying one of the following statistics ($R^2$, residual sum of squares, adjusted $R^2$, $C_p$, BIC, $s$) is displayed. The model with highest adjusted $R^2$ is made the active model and its summary is displayed. Usage bestSubsetsRegressionModel.HH() Author(s) Richard M. Heiberger <rmh@temple.edu> See Also regsubsets
BoxCox
Description Rcmdr menu for Box-Cox Transformations Usage BoxCox() Author(s) John Fox <jfox@mcmaster.ca>
CloseCommanderRestart
Description Close Rcmdr without questions. CloseCommanderNoQuestionRestart has absolutely no questions. CloseCommanderRestart asks only about saving les. Both functions restart Rcmdr immediately and therefore have the full .GlobalEnv from the R session still available. Usage CloseCommanderNoQuestionRestart() CloseCommanderRestart() Author(s) Richard M. Heiberger <rmh@temple.edu> See Also closeCommander
confidenceIntervalsPlot Rcmdr interface to plot condence and prediction intervals in simple linear regression
Description Rcmdr menu interface to the function ci.plot. Variable boxes are provided for one predictor variable, one response variable. The simple linear regression is calculated and made the active model. Usage confidenceIntervalsPlot() Author(s) Richard M. Heiberger <rmh@temple.edu> See Also ci.plot
Interaction2wtRcmdr
DotplottbRcmdr
Description Rcmdr menu interface to dotplot(panel=panel.dotplot.tb). Usage DotplottbRcmdr() Author(s) Richard M. Heiberger <rmh@temple.edu> See Also panel.dotplot.tb
Interaction2wtRcmdr
Description Plot all main effects and twoway interactions in a multifactor design. The main diagonal displays boxplots for the main effects of each factor. The off-diagonals show the interaction plots for each pair of factors. The i,j panel shows the same factors as the j,i but with the trace- and x-factor roles interchanged. Usage Interaction2wtRcmdr() Author(s) Richard M. Heiberger <rmh@temple.edu> See Also interaction2wt
latticeFunctions
latticeFunctions
Description Support functions for the Xyplot.HH2 function. Usage latticeFunctions() latticePanelFunctions() splomFormula(predictor, data.frame.name) usualFormula(functionName, response, predictor, data.frame.name) Arguments predictor, data.frame.name, functionName, response Arguments to functions. Value For latticeFunctions and latticePanelFunctions, vector of function names. For splomFormula and usualFormula, a model formula containing the specied variable names. Author(s) Richard M. Heiberger <rmh@temple.edu> See Also Xyplot.HH
MMCmenu
Description Menu interface to MMC (Meanmean Multiple Comparison) plots. Usage MMCmenu() MMC2menu() AOVModelsP(n=1)
PlotLikertDialog
Description Rcmdr menus to draw graphs of hypotheses, critical values, and p-values. Usage normal.and.t.hypotheses.plot()
FHypothesesPlot() ChisqHypothesesPlot() Author(s) Richard M. Heiberger <rmh@temple.edu>. See Also norm.curve, F.curve, chisq.curve
PlotLikertDialog
Description Please see likert for details on the plot.likert and related functions.
PredictModel Usage PlotLikertDialog() listAllLikertCapable(envir = .GlobalEnv, ...) LikertFormula() LikertFormulaConstruct(functionName, response, predictor) varPosnOriginal(variables, type = c("all", "factor", "numeric", "nonfactor", "twoLevelFactor")) Arguments envir, ... Arguments to ls. functionName, response, predictor Arguments to functions. variables, type See varPosn for discussion. Value
For listAllLikertCapable, a character vector of names of all objects that satisfy the search criteria in the specied environments. See likert for details on what objects are likert capable. LikertFormulaConstruct constructs a model formula for use by plot.likert.formula from its input arguments. varPosnOriginal is the same as varPosn except that it always keeps the variables in the same order as the original data.frame. Author(s) Richard M. Heiberger <rmh@temple.edu> See Also likert
PredictModel
Description Rcmdr menu interface to predict Usage PredictModel() Author(s) Richard M. Heiberger <rmh@temple.edu>
QQPlot.HH
Projector
Set Rcmdr options for good visibility on classroom projector and on netbook screen with 600 pixel height.
Description Set Rcmdr options for good visibility on classroom projector and on netbook screen with 600 pixel height. Usage Projector() H6 () Author(s) Richard M. Heiberger <rmh@temple.edu>
QQPlot.HH
Description Rcmdr menu interface to plot the qqplot of variable against one of the following distributions: normal, t, chi-square, F, other. Usage QQPlot.HH() Details The normal gives the option to do the Shapiro-Wilk test of normality. The other requires you to specify the distribution. Any distribution for which quantile and density functions exist in R (with prexes q and d, respectively) may be used. Value NULL. These functions are used only for their side effect (to make a graph). Author(s) John Fox <jfox@mcmaster.ca>. ShapiroWilk test added by Richard M. Heiberger <rmh@temple.edu>.
11
Regr1Plot
Description Rcmdr Menu function to display the squared residuals of a linear t of one y variable on one x variable. The default model is simple linear regression y ~ x. Any other model of one y on one x may be used. See the last example in regr1.plot for an example of a quadratic function of x. Usage Regr1Plot() Author(s) Richard M. Heiberger <rmh@temple.edu> See Also regr1.plot
ResizeEtcDialog
Description Please see ResizeEtc for details on the combination of "trellis" and related functions. Usage ResizeEtcDialog() listAllTrellisObjects(envir = .GlobalEnv, ...) Arguments envir, ... Details This dialog is a template designed to help with writing commandline code. Arguments to ls.
12 Value
Scatter3DDialog.HH
For listAllTrellisObjects, a character vector of names of all "trellis" objects that satisfy the search criteria in the specied environments. Author(s) Richard M. Heiberger <rmh@temple.edu> See Also ResizeEtc, resizePanels
R_options
Description Set R options from within R commander. Usage R_options() Author(s) Richard M. Heiberger <rmh@temple.edu>
Scatter3DDialog.HH
Description This dialog sets up a call to the scatter3dHH function to draw a three-dimensional scatterplot, and optionally to identify3d to label points interactively with the mouse. Details The explanatory variables provide the "horizontal" and "out-of-screen" axes of the scatterplot, the response variable provides the "vertical" axis. Data points are represented as spheres or points, depending upon the number of observations. Several regression surfaces can be plotted: a linear least-squares surface; a full quadratic leastsquares surface with squared and cross-product terms; a "smooth" regression surface either a smoothing spline, if no degrees of freedom are specied (in which case the gam function selects the df by generalized cross validation), or a xed-df regression spline; an additive-regression surface (also t by gam), with either smoothing spline or regression spline components (again selected
scatter3dHH
13
according to the specication of degrees of freedom). If only one surface is t, then residuals are plotted as red (negative) and green (positive) lines from the surface to the points. If the squared residuals option is checked, then squared residuals are plotted. The sum of the area of these squares is the "residual sum of squares". You can specify a factor dening groups by pressing the Plot by groups button. A separate surface or set of surfaces is plotted for each level of the groups factor. These surfaces can be constrained to be parallel. The completed plot can be manipulated with the mouse: Click, hold, drag the left mouse button to rotate the display; click, hold, and drag the right button (or centre button on a three-button mouse) to zoom in and out. If the box labelled Identify observations with mouse is checked, you may use the mouse to identify points interactively: Press the right mouse button (or the centre button on a three-button mouse), drag a rectangle around the points to be identied, and release the button. Repeat this procedure for each point or set of "nearby" points to be identied. To exit from point-identication mode, right-click (or centre-click) in an empty region of the plot. Points may also be identied subsequently by selecting Identify observations with mouse from the R Commander 3D graph menu: As above, click and drag the left mouse button to rotate the display, and click and drag the right (or centre) button to identify points. Author(s) John Fox <jfox@mcmaster.ca>. Squared residuals added by Richard M. Heiberger <rmh@temple.edu>. See Also scatter3dHH, identify3d, rgl.open, gam
scatter3dHH
Description The scatter3d function uses the rgl package to draw 3D scatterplots with various regression surfaces. The function identify3d allows you to label points interactively with the mouse: Press the right mouse button (on a two-button mouse) or the centre button (on a three-button mouse), drag a rectangle around the points to be identied, and release the button. Repeat this procedure for each point or set of nearby points to be identied. To exit from point-identication mode, click the right (or centre) button an empty region of the plot. This is a revision of the Rcmdr scatter3d to add the ability to plot squared residuals. Usage scatter3dHH(x, y, z, xlab=deparse(substitute(x)), ylab=deparse(substitute(y)), zlab=deparse(substitute(z)), revolutions= , bg.col=c("white", "black"),
14 axis.col=if (bg.col == "white") "black" else "white", surface.col=c("blue", "green", "orange", "magenta", "cyan", "red", "yellow", "gray"), neg.res.col="red", pos.res.col="green", point.col="yellow", text.col=axis.col, grid.col=if (bg.col == "white") "black" else "gray", fogtype=c("exp2", "linear", "exp", "none"), residuals=(length(fit) == 1), surface=TRUE, grid=TRUE, grid.lines=26, df.smooth=NULL, df.additive=NULL, sphere.size=1, threshold= . 1, speed=1, fov=6 , fit="linear", groups=NULL, parallel=TRUE, model.summary=FALSE, squares = FALSE, square.color = "gray", coef.ratio = 1, ...) Arguments x y variable for horizontal axis. variable for vertical axis (response).
scatter3dHH
z variable for out-of-screen axis. xlab, ylab, zlab axis labels. revolutions bg.col axis.col number of full revolutions of the display. background colour; one of "white", "black". colour for axes; default is "white" for black background, "black" for white background.
surface.col vector of colours for regression planes, used in the order specied by fit. neg.res.col, pos.res.col colours for lines representing negative and positive residuals. point.col text.col grid.col fogtype residuals surface grid grid.lines df.smooth colour of points. colour of axis labels. colour of grid lines on the regression surface(s). type of fog effect; one of "exp2", "linear", "exp", "none". plot residuals (TRUE or FALSE); available only when there is one surface plotted. plot surface(s) (TRUE or FALSE). plot grid lines on the regression surface(s) (TRUE or FALSE). number of lines (default, 26) forming the grid, in each of the x and y directions. degrees of freedom for the two-dimensional smooth regression surface; if NULL (the default), the gam function will select the degrees of freedom for a smoothing spline by generalized cross-validation; if a positive number, a xed regression spline will be t with the specied degrees of freedom. degrees of freedom for each explanatory variable in an additive regression; if NULL (the default), the gam function will select degrees of freedom for the smoothing splines by generalized cross-validation; if a positive number or a vector of two positive numbers, xed regression splines will be t with the specied degrees of freedom for each term.
df.additive
15 relative sizes of spheres representing points; the actual size is dependent on the number of observations. if the actual size of the spheres is less than the threshold, points are plotted instead. relative speed of revolution of the plot. eld of view (in degrees); controls degree of perspective. one or more of "linear", "quadratic", "smooth", "additive"; to display tted surface(s); partial matching is supported e.g., c("lin", "quad"). if NULL (the default), no groups are dened; if a factor, a different surface or set of surfaces is plotted for each level of the factor; in this event, the colours in plane.col are used successively for the points, surfaces, and residuals corresponding to each level of the factor. when plotting surfaces by groups, should the surfaces be constrained to be parallel? A logical value, with default TRUE. print summary or summaries of the model(s) t (TRUE or FALSE). colours for the point labels, given by group. There must be at least as many colours as groups; if there are no groups, the rst colour is used. Normally, the colours would correspond to the plane.col argument to scatter3d. logical. If TRUE, the residuals are plotted as squares. The sum of the area of the squares is the "residual sum of squares". If FALSE, the residuals are plotted as vertical lines. color for the squares. number, defaults to 1. Settig coef.ratio to a number other than 1 is a primitive way of plotting squared pseudo-residuals that are not the least-squares residuals. The reason for displaying non-least-squares residuals is to compare them to the least-squares residuals and thus get a 3d visual image of what minimizing the sum of squares actually means. other arguments are ignored.
squares
square.color coef.ratio
... Value
scatter3d not return a useful value; it is used for its side-effect of creating a 3D scatterplot. indentify3d returns the labels of the identied points. Note You have to install the rgl and mgcv packages to produce 3D plots. Author(s) John Fox <jfox@mcmaster.ca>. Squared residuals added by Richard M. Heiberger <rmh@temple.edu>. See Also rgl.open, gam
16 Examples
scatterPlotMatrix.HH
## Not run: State.x77 <- as.data.frame(state.x77) with(State.x77, scatter3d(Income, Murder, Illiteracy)) with(State.x77, identify3d(Income, Murder, Illiteracy, labels=row.names(State.x77))) with(State.x77, scatter3d(Income, Murder, Illiteracy, fit=c("linear", "quadratic"))) ## End(Not run)
scatterPlot.HH
Description Alternate menu into the scatterplot in the car package. This menu by default uses solid dots, larger fonts, and turns off marginal boxplots and smoother lines. Otherwise it is identical to the Rcmdr Scatterplot menu item. Usage scatterPlot.HH() Author(s) Richard M. Heiberger <rmh@temple.edu>
scatterPlotMatrix.HH
Scatterplot Matrices
Description This is variation of the Rcmdr interface to the car package scatterplot.matrix. The revision uses row1attop=FALSE to force the main diagonal of the scatterplot matrix to go uphill from southwest to northeast. Usage scatterPlotMatrix.HH() Author(s) John Fox <jfox@mcmaster.ca>. row1attop=FALSE added by Richard M. Heiberger <rmh@temple.edu>. See Also scatterplot.matrix
twoWayTable.HH
17
twoWayTable.HH
Description Pearsons Chi-squared Test for Count Data twoWayTable.HH is an original Rcmdr.HH function. It reads the active dataset and constructs the table using xtabs. enterTable.HH is an original Rcmdr.HH function. It opens a window where the user may enter a table manually. analyzeTwoWayTable.HH is an additional function. It uses the active dataset as the table. All three produce identical output, a two-way table, row and column summaries, and the chi square test. Usage twoWayTable.HH() enterTable.HH() analyzeTwoWayTable.HH() Author(s) John Fox <jfox@mcmaster.ca>. additional entry options by Richard M. Heiberger <rmh@temple.edu>. See Also chisq.test
Xyplot.HH
Rcmdr Menu function to specify xyolot, other lattice plots, and likert plots.
Description These are enhancements of the Rcmdr Xyplot function (which I wrote) to include layout parameters and plot type, to force solid dots, and to distinguish between conditioning variables in the formula and group variables. Xyplot.HH is an interface to the xyplot function. Xyplot.HH2 is an interface to many of the lattice functions (xyplot, bwplot, splom, barchart, dotplot) and to the formula method for likert in the HH package.
18 Usage Xyplot.HH() Xyplot.HH2() Author(s) Richard M. Heiberger <rmh@temple.edu> See Also xyplot, likert
Xyplot.HH
Index
Topic distribution QQPlot.HH, 10 Topic environment Projector, 10 R_options, 12 Topic hplot bestSubsetsRegressionModel.HH, 4 confidenceIntervalsPlot, 5 DotplottbRcmdr, 6 Interaction2wtRcmdr, 6 latticeFunctions, 7 MMCmenu, 7 normal.and.t.hypotheses.plot, 8 PlotLikertDialog, 8 QQPlot.HH, 10 Regr1Plot, 11 ResizeEtcDialog, 11 Scatter3DDialog.HH, 12 scatter3dHH, 13 scatterPlot.HH, 16 scatterPlotMatrix.HH, 16 Xyplot.HH, 17 Topic htest twoWayTable.HH, 17 Topic manip BoxCox, 4 Topic misc CloseCommanderRestart, 5 Topic package RcmdrPlugin.HH-package, 2 Topic regression anovaTableI.HH, 3 bestSubsetsRegressionModel.HH, 4 PredictModel, 9 analyzeTwoWayTable.HH (twoWayTable.HH), 17 anova, 4 anovaTableI.HH, 2, 3 anovaTableII.HH (anovaTableI.HH), 3 19 AOVModelsP (MMCmenu), 7 bestSubsetsRegressionModel.HH, 2, 4 BoxCox, 4 chisq.curve, 8 chisq.test, 17 ChisqHypothesesPlot (normal.and.t.hypotheses.plot), 8 ci.plot, 3, 5 closeCommander, 5 CloseCommanderNoQuestionRestart (CloseCommanderRestart), 5 CloseCommanderRestart, 5 confidenceIntervalsPlot, 5 DotplottbRcmdr, 6 enterTable.HH (twoWayTable.HH), 17 F.curve, 8 FHypothesesPlot (normal.and.t.hypotheses.plot), 8 gam, 1215 H6 (Projector), 10
identify3d, 12, 13 interaction2wt, 3, 6 Interaction2wtRcmdr, 6 latticeFunctions, 7 latticePanelFunctions (latticeFunctions), 7 likert, 8, 9, 18 LikertFormula (PlotLikertDialog), 8 LikertFormulaConstruct (PlotLikertDialog), 8
20 listAllLikertCapable (PlotLikertDialog), 8 listAllTrellisObjects (ResizeEtcDialog), 11 ls, 9, 11 MMC2menu (MMCmenu), 7 MMCmenu, 7 norm.curve, 3, 8 normal.and.t.hypotheses.plot, 8 normalHypothesesPlot (normal.and.t.hypotheses.plot), 8 panel.bwplot.intermediate.hh, 3 panel.dotplot.tb, 6 plot.likert.formula, 9 PlotLikertDialog, 8 predict, 10 PredictModel, 9 Projector, 10 qq.plot, 11 QQPlot.HH, 3, 10 R_options, 12 Rcmdr, 3 Rcmdr.HH (RcmdrPlugin.HH-package), 2 Rcmdr.HH-package (RcmdrPlugin.HH-package), 2 RcmdrPlugin.HH (RcmdrPlugin.HH-package), 2 RcmdrPlugin.HH-package, 2 regr1.plot, 11 Regr1Plot, 11 regsubsets, 2, 4 ResizeEtc, 11, 12 ResizeEtcDialog, 11 resizePanels, 12 rgl.open, 13, 15 Scatter3D (Scatter3DDialog.HH), 12 Scatter3DDialog.HH, 12 scatter3dHH, 2, 12, 13, 13 scatterPlot.HH, 16 scatterplot.matrix, 3, 16 scatterPlotMatrix.HH, 3, 16 shapiro.test, 11 splomFormula (latticeFunctions), 7
INDEX tHypothesesPlot (normal.and.t.hypotheses.plot), 8 twoWayTable.HH, 2, 17 usualFormula (latticeFunctions), 7 varPosn, 9 varPosnOriginal (PlotLikertDialog), 8 xyplot, 18 Xyplot.HH, 7, 17 Xyplot.HH2 (Xyplot.HH), 17