pmg -- poor man's gui an r gui for introductory - user! 2007

31
Outline What is PMG? Using PMG for typical tasks in an introductory statistics course Closing pmg – Poor Man’s GUI an R GUI for Introductory Statistics John Verzani CUNY/The College of Staten Island useR!2007

Upload: others

Post on 11-Feb-2022

14 views

Category:

Documents


0 download

TRANSCRIPT

Outline What is PMG? Using PMG for typical tasks in an introductory statistics course Closing

pmg – Poor Man’s GUIan R GUI for Introductory Statistics

John Verzani

CUNY/The College of Staten Island

useR!2007

Outline What is PMG? Using PMG for typical tasks in an introductory statistics course Closing

1 What is PMG?The basic GUI

2 Using PMG for typical tasks in an introductory statistics courseExploratory Data AnalysisSummary statisticsWhy dynamic dialogs?Statistical InferenceLinear ModelingExtending pmg

3 Closing

Outline What is PMG? Using PMG for typical tasks in an introductory statistics course Closing

PMG is a graphical user interface (GUI) for R

It is similar to the Rcmdr interface, only using a more moderntoolkit

It is cross-platform (Windows, mac and linux). (It usesRGtk2.)

It takes advantage of the drag-and-drop features of RGtk2 formany of its dialogs.

It is well suited for introductory statistics courses

Outline What is PMG? Using PMG for typical tasks in an introductory statistics course Closing

Starting pmg

The pmg package must first be installed. It relies on a few CRANpackages, most importantly the RGtk2 package. (This ismulti-platform, but for some platforms system libraries need to beinstalled).A command like

install pmg

> install.packages("pmg", dep=TRUE)

Might just work. (A script is available for windows to downloadthe gtk libraries.)The GUI is started with:

Start GUI

> require(pmg)

Outline What is PMG? Using PMG for typical tasks in an introductory statistics course Closing

The basic GUI

Figure: PMG on startup

Outline What is PMG? Using PMG for typical tasks in an introductory statistics course Closing

GUI Pieces: The menu bar

Figure: PMG menubar and toolbar

Outline What is PMG? Using PMG for typical tasks in an introductory statistics course Closing

The quick drop area

Figure: PMG quick drop area

Outline What is PMG? Using PMG for typical tasks in an introductory statistics course Closing

A notebook to hold dialogs

Figure: PMG dialog area

Outline What is PMG? Using PMG for typical tasks in an introductory statistics course Closing

Command line

Figure: PMG command area

Outline What is PMG? Using PMG for typical tasks in an introductory statistics course Closing

Loading a data set

Loading a data set can be done through the dialogData::Loaddata set

Figure: Loading a data set. Double click the data set name.

Outline What is PMG? Using PMG for typical tasks in an introductory statistics course Closing

Workspace browser area

A data set when loaded appears in the workspace browser area.

Figure: Data set appearing in workspace browser area

Outline What is PMG? Using PMG for typical tasks in an introductory statistics course Closing

Other useful dialogs

There are similar dialogs to

Install a CRAN package (install.packages)

Load a package (require)

Save and restore a workspace

Source a file

Browse the help system

Outline What is PMG? Using PMG for typical tasks in an introductory statistics course Closing

A boxplot

There are atleast two ways to do most basic things in pmg.

simple dialogs which gather a function’s arguments and callthe function when“ok” is selected. These print out an Rcommand for students to learn

A“dynamic dialog”which can be directed easily using just themouse through drag and drop or clicking, but which does nottry to teach the students the R syntax.

One is more instructive and flexible, the other easier to learn.

Outline What is PMG? Using PMG for typical tasks in an introductory statistics course Closing

The Plots::Univariate::Boxplot dialog

The first way is illustrated with thePlots::Univariate::Boxplot dialog. The figure shows thedialog after some values were filled in.

Figure: Basic boxplot dialog for png. There are means to modify each ofthe boxplot function’s arguments.

Outline What is PMG? Using PMG for typical tasks in an introductory statistics course Closing

Simple dialogs (cont.)

There are a few conveniences with these simple dialogs.

The variable Cars93$MPG.highway was dragged over fromthe variable browser. This could be typed in. Expressions,such as rnorm(100), are okay, as this value gets evaluatedwithin the global environment.

The“help”button will call up the help page for the function(boxplot), and each label for the arguments, when clicked, willcall up the corresponding section from the help page toexplain that argument.

Outline What is PMG? Using PMG for typical tasks in an introductory statistics course Closing

Lattice explorer

The lattice explorer ( Plots::Lattice explorer) is a“dynamicdialog”and can be used to drag variables from the workspace areato create plots. Dragging and dropping the MPG.highway variable,and changing the graphic selector gives the figure.

Figure: Boxplot produces using the Lattice Explorer

Outline What is PMG? Using PMG for typical tasks in an introductory statistics course Closing

Lattice explorer: multivariate

The lattice explorer makes multi-variate explorations easy.Dropping a factor onto the graphic will produce the followingfigure.

Figure: Lattice explorer after a factor is dropped following a numericvariable.

Outline What is PMG? Using PMG for typical tasks in an introductory statistics course Closing

Lattice explorer (cont.)

Changing the plot selector will produce a different graphic. Useclear to start over with new variables.Unlike the other dialog, there is no way to change things such asthe title or orientation, etc. Again, the trade-off between easier tolearn versus flexibility.

Outline What is PMG? Using PMG for typical tasks in an introductory statistics course Closing

Quantiles

The basic dialogs are more or less generated from the underlying Rfunction’s arguments. A few have been optimized such as thequantile dialog.

Figure: The Data::Quantiles dialog showing a graphic in addition to asummary.

Outline What is PMG? Using PMG for typical tasks in an introductory statistics course Closing

The mean

Similarly there are dialogs to compute summary statistics, such asthe mean. There is a basic dialog where any applicable argumentscan be entered (blanks are left out)

Figure: basic dialog for the mean where a few arguments can be adjusted.

Outline What is PMG? Using PMG for typical tasks in an introductory statistics course Closing

cont.

The output of the R command appears in the command area:

Figure: Command area showing output from finding the mean

Unlike the next dynamic dialog, these dialogs produce an Rcommand that can be copied and pasted into a word processor forreport writing or, if desired, edited in the commands area.

Outline What is PMG? Using PMG for typical tasks in an introductory statistics course Closing

the mean using the Dynamic summaries feature

As with the Lattice explorer, there is a more interactive dialog forfinding the mean under Data::Dynamic summaries. We draggedtwo variables over to produce the following:

Figure: Dynamic summaries dialog showing how to find the mean forgrouped data.

Outline What is PMG? Using PMG for typical tasks in an introductory statistics course Closing

Why dynamic

Some of the design of pmg was influenced by the Fathom DynamicData software of Key Curriculum Press. There the graphics aretightly linked with a data frame viewer. The data frame viewer inpmg can be used the same way. First, drag the data set over theData tab and onto the Open button. This will open it in the dataframe editor.Then drag a column header onto a drop area for a dynamic dialog;and then click open the subset= area and select a variable toadjust. The dialog should adjust accordingly.

Outline What is PMG? Using PMG for typical tasks in an introductory statistics course Closing

The t test

Statistical inference has similar functionality. There is a t-testdialog that can be used. In this case we show the bivariate t-test

Figure: A two-sample t-test

Outline What is PMG? Using PMG for typical tasks in an introductory statistics course Closing

Dynamic tests

The Tests::Dynamic tests dialog takes its output from that ofthe htest class. It should look more or less familiar. The bold text,when clicked, allows for editing of those parameter values. One canuse a formula interface by selecting from the top popup widget.

Figure: Dynamic tests dialog showing a two-sample t-test. The boldareas allow for editing.

Outline What is PMG? Using PMG for typical tasks in an introductory statistics course Closing

Linear modeling

Another common topic in an introductory statistics course is thesimple linear model. Again there are two different ways to do this.

Figure: Simple dialog for lm. The formula was added using the dialog forediting formulas.

Outline What is PMG? Using PMG for typical tasks in an introductory statistics course Closing

Simple lm dialog cont.

The model formula editing dialog was modeled on one from S-Plus

Figure: Model formula editing dialog

Outline What is PMG? Using PMG for typical tasks in an introductory statistics course Closing

The dynamic models dialog

The dynamic models dialog for linear regression is intended to beused in a drag-and-drop manner. The model formula are built upin a simple manner. (They can be edited if desired). Some quickactions are available from a popup-box on the right.

Figure: The dynamic models dialog. Dropping variables produces asimple model formula without interactions

Outline What is PMG? Using PMG for typical tasks in an introductory statistics course Closing

Extending the GUI

One of the neat parts of Rcmdr has been the interest in extendingthe GUI (RcmdrPlugin.TeachingDemos,Rcmdr.HH, TsCmdr, ...)for specific purposes.Currently, no plug-in architecture is supported, but there is ameans to add to the toolbar using pmg.addMenubar.Additionally, pmg is written using the gWidgets package whichmakes it relatively easy to develop new GUIs. Yvonnick Noelcontributed several that are available under the Plots::TeachingDemos dialog.

Outline What is PMG? Using PMG for typical tasks in an introductory statistics course Closing

Teaching Demos Dialog

Figure: Teaching demos notebook

Outline What is PMG? Using PMG for typical tasks in an introductory statistics course Closing

What is lacking?

Hopefully you’ve been convinced that pmg offers an easy-to-learnGUI for R that can easily handle most tasks of an introductorystatistics course. Of course, pmg could be improved. Here are someimmediate areas:

There is no report writing functionality

I like the dynamic dialogs, the others have a“website” feel.Are either the right metaphor for introductory students? The“inference for office”project of Josh van Eikeren provides analternative akin to Mathematica worksheets. (Windows only)

Rcmdr has a more advanced set of dialogs.

Rcmdr has spawned a number of topic specific spinoffs (e.g.,TsCmdr). Easily adding new menu items could be improved.