Experiences with and Recommendations for using R for Statistics/Analytics Instruction Abstract: R was the top software in the 2016 KDnuggets Software Poll that asked practicing professionals what software they used for Analytics, Data Mining, Data Science, and Machine Learning projects in the past 12 months. The presenters in this session will report on their experiences with teaching statistics and analytics procedures using R software. This will include the R integration features in JMP and discuss reasons for using R from inside JMP. SEDSI 2017 DASI Session, Thursday, February, 23, 2017, 3 PM
Experiences with and Recommendations for using R for Statistics/Analytics Instruction “Using JMP with R” David Stephan Two Bridges Instructional Technology david@TwoBridgesIT.com SEDSI 2017 DASI Session, Thursday, February 23, 2016, 3 PM
Why?!! Instructional Reasons Curricular Reasons Career/Job Placement Considerations Disclaimer: May not be for you or your students
Possibly Your Context? My students are general business students My students seek managerial, not technical careers My school can afford JMP My school is non-residential and/or has many distance learners
Is Quality of Help Available a Concern? Not all HELP is created equal!
Do Your Students Need This?
Why Not Just JMP? My program has a more “technical” bent, even though we are teaching future mgrs. Not what the “cool kids” use Does JMP do method-of-your-choice? Job placements require “R experience”
Why Not Just R? “Let a thousand programmers bloom”1 did not work for Mao Zedong. Do we really want knowledge workers not experiencing commercial software? Have you done basic statistics in R? 1May be a slight misquotation
Why JMP and R--what a JMP Staffer Says “JMP is a wonderful complement to R. The integration with R is surfaced with several new JSL commands that allow you to connect to an install of R on your desktop, send data to and from R, and submit R routines available through the R packages. JMP dialogs can easily be built for parameter input to R as a front-end, and more significantly, JMP’s interactive and dynamic statistical platforms and graphics make for a perfect back-end to R functions. The dialog below is an application that connects to R to create data for a given distribution and perform simulations to test the coverage of bootstrap confidence intervals for a few common statistics.” --Kelci Miclause, JMP
Why JMP and R? Best to interactively explore data (e.g., subsetting, aggregation) JMP’s descriptive analytics results for many procedures Can present a better engineered user experience for students
Why JMP and R? (not so obvious) Exposes students to scripting Give students practice with software integration Enables project management assignments It’s not an all (or ) world
Software Tools Used JMP Pro 13 and JSL scripting language (also works in JMP 12 or 13) R version 3.3.2 with various libraries RStudio 2.3-2 (not much help this time)
Required Skills JMP user that can perform basic analyses Some awareness/experience with scripting languages in general Able to search Internet or ask “Buddy” (but not Siri or Alexa!) questions
Getting Started Install JMP and R (libraries optional, can be added on the fly) Open JMP Script window File > Open (select script from dialog) or File > New > Script Execute R Init(); (opens R and links JMP to R)
JSL R-integration Basics R Init(); (opens R and links JMP to R) R Send(); (sends data to R) R Get(); (retrieves data from R) R Submit(“ ”); (sends R commands to R) R Term(); (terminates JMP and R link)
JSL R-integration: How it works Command line (log) output appears in JMP log window Graphic outputs appear in separate window (as they would in R)
JSL General Commands Used Open(); opens a data source in JMP New Window(); and Button Box() together allow creation of dialogs with command buttons (minimally implemented in examples)
JSL Utility Commands Used Open(); opens a data source in JMP New Window(); and Button Box() together allow creation of dialogs with command buttons (minimally implemented in examples)
Disclaimers for Examples Emphasizes concepts, not techniques Not necessarily examples of how to best apply JMP or R No specialized or obscure R methods
Open in JMP and Use Data in R R Init(); dtOrig= Open(); New Window( "Select Data", Button Box( "Send Selected Data To R", JMPdt = Current Data Table(); R Send( JMPdt, Selected( 1 ) ); R Submit( "print(JMPdt)" ); ) );
Open in JMP and Use Data in R Result
Back and Forth From R R Init(); R Submit( "data(attitude)" ); R Get( "attitude" ) << New Data View; New Window( "Attitude Survey", Button Box( "Send Selected Data To R", JMPdt = Current Data Table(); R Send( JMPdt, Selected( 1 ) ); R Submit( "print(JMPdt)" ); R Get(JMPdt)<<NewDataView; ) );
Back and Forth From R Result
“Better” Back and Forth From R R Init(); R Submit( "data(attitude)" ); R Get( "attitude" ) << New Data View; New Window( "Attitude Survey", Button Box( "Send Selected Data To R", JMPdt = Current Data Table(); R Send( JMPdt, Selected( 1 ) ); R Submit( " newTable <- rbind(JMPdt, JMPdt[]) " ); R Get(JMPdt)<<NewDataView; ) );
Better Back and Forth From R Result
Open in JMP and Use Data in R (recalled) R Init(); dtOrig= Open(); New Window( "Select Data", Button Box( "Send Selected Data To R", JMPdt = Current Data Table(); R Send( JMPdt, Selected( 1 ) ); R Submit( "print(JMPdt)" ); ) );
Use R for Hierarchical Cluster Analysis R Init(); dtOrig = Open(“F:/ThrillRides.jmp”); New Window( “Thrill Rides", Button Box( "Send Selected Data To R", JMPdt = Current Data Table(); R Send( JMPdt, Selected( 1 ) ); R Submit( " dd <- dist(scale(JMPdt[, 3:9]), method = \!"euclidean\!" ) hc <- hclust(dd, method = \!"centroid\!") plot(hc, labels = JMPdt[, 2]) "); ) );
R plot(hc) and JMP Dendograms (unfair comparison?)
JMP Fully Interactive Dashboard
JMP Data Table Subsetting
Two Bridges Instructional Technology david@TwoBridgesIT.com Thank You! David Stephan Two Bridges Instructional Technology david@TwoBridgesIT.com SEDSI 2017 DASI Session, Thursday, February 23, 2016, 3 PM