Type: Package
Title: Rcmdr Support for the HH Package
Version: 1.1-51
Date: 2024-03-07
Author: Richard M. Heiberger, with contributions from Burt Holland
Maintainer: Richard M. Heiberger <rmh@temple.edu>
Depends: R (≥ 3.0.2), HH
Imports: Rcmdr (≥ 2.0-0), lattice, mgcv
Suggests: car, leaps, latticeExtra, rgl
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.
License: GPL-2 | GPL-3 [expanded from: GPL (≥ 2)]
NeedsCompilation: no
Packaged: 2024-03-06 22:47:47 UTC; rmh
Repository: CRAN
Date/Publication: 2024-03-06 23:40:11 UTC

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

The DESCRIPTION file:

Package: RcmdrPlugin.HH
Type: Package
Title: Rcmdr Support for the HH Package
Version: 1.1-51
Date: 2024-03-07
Author: Richard M. Heiberger, with contributions from Burt Holland
Maintainer: Richard M. Heiberger <rmh@temple.edu>
Depends: R (>= 3.0.2), HH
Imports: Rcmdr (>= 2.0-0), lattice, mgcv
Suggests: car, leaps, latticeExtra, rgl
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.
License: GPL (>= 2)

Index of help topics:

BoxCox                  Rcmdr BoxCox demo renamed to active function.
CloseCommanderRestart   Close Rcmdr without questions and then restart.
DotplottbRcmdr          Rcmdr menu interface to
                        dotplot(panel=panel.dotplot.tb).
Interaction2wtRcmdr     Rcmdr menu interface to interaction2wt
MMCmenu                 Menu interface to MMC plots.
PlotLikertDialog        Rcmdr Menu function to specify a likert plot.
PredictModel            Rcmdr menu interface to predict
Projector               Set Rcmdr options for good visibility on
                        classroom projector and on netbook screen with
                        600 pixel height.
QQPlot.HH               Quantile-Comparison (QQ) Plot
R_options               Set R options from within R commander.
RcmdrPlugin.HH-package
                        Functions added to the Rcmdr package to support
                        the introductory course at Temple University.
Regr1Plot               Rcmdr Menu function to display the squared
                        residuals.
ResizeEtcDialog         Rcmdr Menu function to specify combining and
                        resizing "trellis" objects.
Scatter3DDialog.HH      Rcmdr 3D Scatterplot Dialog (HH)
Xyplot.HH               Rcmdr Menu function to specify xyolot, other
                        lattice plots, and likert plots.
anovaTableI.HH          Rcmdr interfacce to anova function
bestSubsetsRegressionModel.HH
                        Rcmdr interface to the regsubsets function in
                        the leaps package.
confidenceIntervalsPlot
                        Rcmdr interface to plot confidence and
                        prediction intervals in simple linear
                        regression
latticeFunctions        Support functions for the Xyplot.HH2 function.
normal.and.t.hypotheses.plot
                        Rcmdr normalHypothesesPlot and tHypothesesPlot
                        menu.
scatter3dHH             Three-Dimensional Scatterplots and Point
                        Identification
scatterPlot.HH          Scatterplot menu with different defaults than
                        Rcmdr.
scatterPlotMatrix.HH    Scatterplot Matrices
twoWayTable.HH          Rcmdr menu interface to chisq.test

bestSubsetsRegressionModel.HH Rcmdr interface to the regsubsets function in the leaps package.

twoWayTable.HH Pearson's 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-least-squares plane for pedagogical comparison.

ci.plot Plot confidence 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 scatterplotMatrix 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 (2015). Statistical Analysis and Data Display: An Intermediate Course with Examples in R. Second Edition. Springer-Verlag, New York. https://link.springer.com/book/10.1007/978-1-4939-2122-5

Heiberger, Richard M. and Holland, Burt (2004). Statistical Analysis and Data Display: An Intermediate Course with Examples in S-Plus, R, and SAS, First Edition. Springer Texts in Statistics. Springer. https://link.springer.com/book/10.1007/978-1-4757-4284-8.

See Also

Rcmdr

Examples

## Not run: 
   ## start R
   library(RcmdrPlugin.HH)        ## loads the package and opens the Rcmdr
                                  ## window with the HH menu

## End(Not run)

Rcmdr BoxCox demo renamed to active function.

Description

Rcmdr menu for Box-Cox Transformations

Usage

BoxCox()

Author(s)

John Fox jfox@mcmaster.ca


Close Rcmdr without questions and then restart.

Description

Close Rcmdr without questions. CloseCommanderNoQuestionRestart has absolutely no questions. CloseCommanderRestart asks only about saving files. 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


Rcmdr menu interface to dotplot(panel=panel.dotplot.tb).

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


Rcmdr menu interface to interaction2wt

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


Menu interface to MMC plots.

Description

Menu interface to MMC (Mean–mean Multiple Comparison) plots.

Usage

MMCmenu()
MMC2menu()
AOVModelsP(n=1)

Arguments

n

Minimum number of "aov" models.

Author(s)

Richard M. Heiberger <rmh@temple.edu>


Rcmdr Menu function to specify a likert plot.

Description

Please see likert for details on the plot.likert and related functions.

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 specified 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


Rcmdr menu interface to predict

Description

Rcmdr menu interface to predict

Usage

PredictModel()

Author(s)

Richard M. Heiberger <rmh@temple.edu>

See Also

predict


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()
H600()

Author(s)

Richard M. Heiberger <rmh@temple.edu>


Quantile-Comparison (QQ) Plot

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 prefixes 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. Shapiro–Wilk test added by Richard M. Heiberger <rmh@temple.edu>.

See Also

qqPlot, shapiro.test


Set R options from within R commander.

Description

Set R options from within R commander.

Usage

R_options()

Author(s)

Richard M. Heiberger <rmh@temple.edu>


Rcmdr Menu function to display the squared residuals.

Description

Rcmdr Menu function to display the squared residuals of a linear fit 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


Rcmdr Menu function to specify combining and resizing "trellis" objects.

Description

Please see ResizeEtc for details on the combination of "trellis" and related functions.

Usage

ResizeEtcDialog()
listAllTrellisObjects(envir = .GlobalEnv, ...)

Arguments

envir, ...

Arguments to ls.

Details

This dialog is a template designed to help with writing commandline code.

Value

For listAllTrellisObjects, a character vector of names of all "trellis" objects that satisfy the search criteria in the specified environments.

Author(s)

Richard M. Heiberger <rmh@temple.edu>

See Also

ResizeEtc, resizePanels


Rcmdr 3D Scatterplot Dialog (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 least-squares surface with squared and cross-product terms; a "smooth" regression surface — either a smoothing spline, if no degrees of freedom are specified (in which case the gam function selects the df by generalized cross validation), or a fixed-df regression spline; an additive-regression surface (also fit by gam), with either smoothing spline or regression spline components (again selected according to the specification of degrees of freedom). If only one surface is fit, 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 defining 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 identified, and release the button. Repeat this procedure for each point or set of "nearby" points to be identified. To exit from point-identification mode, right-click (or centre-click) in an empty region of the plot.

Points may also be identified 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


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. When either barchart or panel.barchart is selected, then the argument origin=0 is automatically set. When panel.barchart, the user must manually specify the limits (xlim or ylim) to include zero for the effect of origin=0 to be visible.

Usage

Xyplot.HH()
Xyplot.HH2()

Author(s)

Richard M. Heiberger <rmh@temple.edu>

See Also

xyplot, likert


Rcmdr interfacce to anova function

Description

Rcmdr interface to anova function, specifically to get the sequential sums of squares.

Usage

anovaTableI.HH()
anovaTableII.HH()  ## exact copy of John Fox's anovaTable from Rcmdr/R/model-menu.R

Author(s)

Richard M. Heiberger <rmh@temple.edu>

See Also

anova


Rcmdr interface to the regsubsets function in the leaps package.

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


Rcmdr interface to plot confidence 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


Support functions for the Xyplot.HH2 function.

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 specified variable names.

Author(s)

Richard M. Heiberger <rmh@temple.edu>

See Also

Xyplot.HH


Rcmdr normalHypothesesPlot and tHypothesesPlot menu.

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


Three-Dimensional Scatterplots and Point Identification

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 identified, and release the button. Repeat this procedure for each point or set of “nearby” points to be identified. To exit from point-identification 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=0, bg.col=c("white", "black"),
    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=0.01, speed=1, fov=60,
    fit="linear", groups=NULL, parallel=TRUE, model.summary=FALSE,
    squares = FALSE, square.color = "gray", coef.ratio = 1, ...)

Arguments

x

variable for horizontal axis.

y

variable for vertical axis (response).

z

variable for out-of-screen axis.

xlab, ylab, zlab

axis labels.

revolutions

number of full revolutions of the display.

bg.col

background colour; one of "white", "black".

axis.col

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 specified by fit.

neg.res.col, pos.res.col

colours for lines representing negative and positive residuals.

point.col

colour of points.

text.col

colour of axis labels.

grid.col

colour of grid lines on the regression surface(s).

fogtype

type of fog effect; one of "exp2", "linear", "exp", "none".

residuals

plot residuals (TRUE or FALSE); available only when there is one surface plotted.

surface

plot surface(s) (TRUE or FALSE).

grid

plot grid lines on the regression surface(s) (TRUE or FALSE).

grid.lines

number of lines (default, 26) forming the grid, in each of the x and y directions.

df.smooth

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 fixed regression spline will be fit with the specified degrees of freedom.

df.additive

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, fixed regression splines will be fit with the specified degrees of freedom for each term.

sphere.size

relative sizes of spheres representing points; the actual size is dependent on the number of observations.

threshold

if the actual size of the spheres is less than the threshold, points are plotted instead.

speed

relative speed of revolution of the plot.

fov

field of view (in degrees); controls degree of perspective.

fit

one or more of "linear", "quadratic", "smooth", "additive"; to display fitted surface(s); partial matching is supported – e.g., c("lin", "quad").

groups

if NULL (the default), no groups are defined; 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.

parallel

when plotting surfaces by groups, should the surfaces be constrained to be parallel? A logical value, with default TRUE.

model.summary

print summary or summaries of the model(s) fit (TRUE or FALSE).

col

colours for the point labels, given by group. There must be at least as many colours as groups; if there are no groups, the first colour is used. Normally, the colours would correspond to the plane.col argument to scatter3d.

squares

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.

square.color

color for the squares.

coef.ratio

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.

Value

scatter3d not return a useful value; it is used for its side-effect of creating a 3D scatterplot. Identify3d returns the labels of the identified 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

Examples

    ## 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 menu with different defaults than Rcmdr.

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>


Scatterplot Matrices

Description

This is variation of the Rcmdr interface to the car package scatterplotMatrix. 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

scatterplotMatrix


Rcmdr menu interface to chisq.test

Description

Pearson's 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