creating more analytical bandwidth with r...creating more analytical bandwidth with r matthew j....
TRANSCRIPT
![Page 1: Creating more Analytical Bandwidth with R...Creating more Analytical Bandwidth with R Matthew J. Flynn, PhD Predictive Analytics World, New York City, October 20, 2011 mjflynn@travelers.com](https://reader033.vdocument.in/reader033/viewer/2022061004/60b2720d0970ad37df32d479/html5/thumbnails/1.jpg)
Creating more Analytical Bandwidth with R
Matthew J. Flynn, PhD Predictive Analytics World, New York City, October 20, 2011
[email protected] 860-954-0894
![Page 2: Creating more Analytical Bandwidth with R...Creating more Analytical Bandwidth with R Matthew J. Flynn, PhD Predictive Analytics World, New York City, October 20, 2011 mjflynn@travelers.com](https://reader033.vdocument.in/reader033/viewer/2022061004/60b2720d0970ad37df32d479/html5/thumbnails/2.jpg)
R2SAS - Background Travelers is a multi-line top 10 P&C Insurance Carrier – experiencing recent rapid growth in Analytics
Travelers Analytics – 5+ Research Depts., SAS User Group 550+ members, approx. 120 JMP seats (from 0 in two years), and 50-80 current R users
My Role – Modeling, Consulting, & Tool-building
Motivation – All data is on UNIX (AIX & Linux) SAS Servers & variety of databases
Need – Two Groups – 1) Some Experienced modelers are experimenting with R stats, 2) New grads with only R background need quickly to get up to speed with SAS to be productive – currently data access in all manual.
How – R package for (D)COM enables access to JMP Automation and SAS/IT
![Page 3: Creating more Analytical Bandwidth with R...Creating more Analytical Bandwidth with R Matthew J. Flynn, PhD Predictive Analytics World, New York City, October 20, 2011 mjflynn@travelers.com](https://reader033.vdocument.in/reader033/viewer/2022061004/60b2720d0970ad37df32d479/html5/thumbnails/3.jpg)
3
JMP 9 – R Connection (Main Menu(“Help: Scripting Index: R Connection”) )
![Page 4: Creating more Analytical Bandwidth with R...Creating more Analytical Bandwidth with R Matthew J. Flynn, PhD Predictive Analytics World, New York City, October 20, 2011 mjflynn@travelers.com](https://reader033.vdocument.in/reader033/viewer/2022061004/60b2720d0970ad37df32d479/html5/thumbnails/4.jpg)
4
Introducing r2SAS – R – JMP Connection
![Page 5: Creating more Analytical Bandwidth with R...Creating more Analytical Bandwidth with R Matthew J. Flynn, PhD Predictive Analytics World, New York City, October 20, 2011 mjflynn@travelers.com](https://reader033.vdocument.in/reader033/viewer/2022061004/60b2720d0970ad37df32d479/html5/thumbnails/5.jpg)
5
R – JMP Connection - usage - Load the r2SAS library (collection of functions)
![Page 6: Creating more Analytical Bandwidth with R...Creating more Analytical Bandwidth with R Matthew J. Flynn, PhD Predictive Analytics World, New York City, October 20, 2011 mjflynn@travelers.com](https://reader033.vdocument.in/reader033/viewer/2022061004/60b2720d0970ad37df32d479/html5/thumbnails/6.jpg)
6
r2SAS – functions to connect to JMP and SAS
![Page 7: Creating more Analytical Bandwidth with R...Creating more Analytical Bandwidth with R Matthew J. Flynn, PhD Predictive Analytics World, New York City, October 20, 2011 mjflynn@travelers.com](https://reader033.vdocument.in/reader033/viewer/2022061004/60b2720d0970ad37df32d479/html5/thumbnails/7.jpg)
7
Connect to JMP - open an existing JMP data table
![Page 8: Creating more Analytical Bandwidth with R...Creating more Analytical Bandwidth with R Matthew J. Flynn, PhD Predictive Analytics World, New York City, October 20, 2011 mjflynn@travelers.com](https://reader033.vdocument.in/reader033/viewer/2022061004/60b2720d0970ad37df32d479/html5/thumbnails/8.jpg)
8
JMP VB Automation docs – OpenDocument(“filename”)
![Page 9: Creating more Analytical Bandwidth with R...Creating more Analytical Bandwidth with R Matthew J. Flynn, PhD Predictive Analytics World, New York City, October 20, 2011 mjflynn@travelers.com](https://reader033.vdocument.in/reader033/viewer/2022061004/60b2720d0970ad37df32d479/html5/thumbnails/9.jpg)
9
Connect to JMP – run some JSL
![Page 10: Creating more Analytical Bandwidth with R...Creating more Analytical Bandwidth with R Matthew J. Flynn, PhD Predictive Analytics World, New York City, October 20, 2011 mjflynn@travelers.com](https://reader033.vdocument.in/reader033/viewer/2022061004/60b2720d0970ad37df32d479/html5/thumbnails/10.jpg)
10
Create and execute a JSL script from disk
![Page 11: Creating more Analytical Bandwidth with R...Creating more Analytical Bandwidth with R Matthew J. Flynn, PhD Predictive Analytics World, New York City, October 20, 2011 mjflynn@travelers.com](https://reader033.vdocument.in/reader033/viewer/2022061004/60b2720d0970ad37df32d479/html5/thumbnails/11.jpg)
11
Create a new JMP data table & populate it with data
![Page 12: Creating more Analytical Bandwidth with R...Creating more Analytical Bandwidth with R Matthew J. Flynn, PhD Predictive Analytics World, New York City, October 20, 2011 mjflynn@travelers.com](https://reader033.vdocument.in/reader033/viewer/2022061004/60b2720d0970ad37df32d479/html5/thumbnails/12.jpg)
12
Return JMP Formula Column back to R from the JMP Table
![Page 13: Creating more Analytical Bandwidth with R...Creating more Analytical Bandwidth with R Matthew J. Flynn, PhD Predictive Analytics World, New York City, October 20, 2011 mjflynn@travelers.com](https://reader033.vdocument.in/reader033/viewer/2022061004/60b2720d0970ad37df32d479/html5/thumbnails/13.jpg)
13
Via JMP, we can push R data to a JMP table & on through to SAS
![Page 14: Creating more Analytical Bandwidth with R...Creating more Analytical Bandwidth with R Matthew J. Flynn, PhD Predictive Analytics World, New York City, October 20, 2011 mjflynn@travelers.com](https://reader033.vdocument.in/reader033/viewer/2022061004/60b2720d0970ad37df32d479/html5/thumbnails/14.jpg)
14
Send R data to JMP, submit JSL, Fit Model calculating new column, bring back to R
![Page 15: Creating more Analytical Bandwidth with R...Creating more Analytical Bandwidth with R Matthew J. Flynn, PhD Predictive Analytics World, New York City, October 20, 2011 mjflynn@travelers.com](https://reader033.vdocument.in/reader033/viewer/2022061004/60b2720d0970ad37df32d479/html5/thumbnails/15.jpg)
15
Send R data to JMP, submit JSL, Fit Model calculating new column, bring back to R
![Page 16: Creating more Analytical Bandwidth with R...Creating more Analytical Bandwidth with R Matthew J. Flynn, PhD Predictive Analytics World, New York City, October 20, 2011 mjflynn@travelers.com](https://reader033.vdocument.in/reader033/viewer/2022061004/60b2720d0970ad37df32d479/html5/thumbnails/16.jpg)
16
Launch a platform
![Page 17: Creating more Analytical Bandwidth with R...Creating more Analytical Bandwidth with R Matthew J. Flynn, PhD Predictive Analytics World, New York City, October 20, 2011 mjflynn@travelers.com](https://reader033.vdocument.in/reader033/viewer/2022061004/60b2720d0970ad37df32d479/html5/thumbnails/17.jpg)
17
Pause for Questions?
r2SAS – on to connecting with SAS
![Page 18: Creating more Analytical Bandwidth with R...Creating more Analytical Bandwidth with R Matthew J. Flynn, PhD Predictive Analytics World, New York City, October 20, 2011 mjflynn@travelers.com](https://reader033.vdocument.in/reader033/viewer/2022061004/60b2720d0970ad37df32d479/html5/thumbnails/18.jpg)
18
Connect to local PC SAS & directly submit SAS code
![Page 19: Creating more Analytical Bandwidth with R...Creating more Analytical Bandwidth with R Matthew J. Flynn, PhD Predictive Analytics World, New York City, October 20, 2011 mjflynn@travelers.com](https://reader033.vdocument.in/reader033/viewer/2022061004/60b2720d0970ad37df32d479/html5/thumbnails/19.jpg)
19
Connect to local PC SAS & Submit existing SAS program
![Page 20: Creating more Analytical Bandwidth with R...Creating more Analytical Bandwidth with R Matthew J. Flynn, PhD Predictive Analytics World, New York City, October 20, 2011 mjflynn@travelers.com](https://reader033.vdocument.in/reader033/viewer/2022061004/60b2720d0970ad37df32d479/html5/thumbnails/20.jpg)
20
Returned is the SAS log and listing – SAS Datasets can then be Imported into R vectors & data frames
![Page 21: Creating more Analytical Bandwidth with R...Creating more Analytical Bandwidth with R Matthew J. Flynn, PhD Predictive Analytics World, New York City, October 20, 2011 mjflynn@travelers.com](https://reader033.vdocument.in/reader033/viewer/2022061004/60b2720d0970ad37df32d479/html5/thumbnails/21.jpg)
21
Return the result data to R as a data frame & graph
![Page 22: Creating more Analytical Bandwidth with R...Creating more Analytical Bandwidth with R Matthew J. Flynn, PhD Predictive Analytics World, New York City, October 20, 2011 mjflynn@travelers.com](https://reader033.vdocument.in/reader033/viewer/2022061004/60b2720d0970ad37df32d479/html5/thumbnails/22.jpg)
22
example call – connect to UNIX SAS
![Page 23: Creating more Analytical Bandwidth with R...Creating more Analytical Bandwidth with R Matthew J. Flynn, PhD Predictive Analytics World, New York City, October 20, 2011 mjflynn@travelers.com](https://reader033.vdocument.in/reader033/viewer/2022061004/60b2720d0970ad37df32d479/html5/thumbnails/23.jpg)
23
Run an existing program on the server, (passing parameters)
![Page 24: Creating more Analytical Bandwidth with R...Creating more Analytical Bandwidth with R Matthew J. Flynn, PhD Predictive Analytics World, New York City, October 20, 2011 mjflynn@travelers.com](https://reader033.vdocument.in/reader033/viewer/2022061004/60b2720d0970ad37df32d479/html5/thumbnails/24.jpg)
24
Submit SAS code to the SAS server
![Page 25: Creating more Analytical Bandwidth with R...Creating more Analytical Bandwidth with R Matthew J. Flynn, PhD Predictive Analytics World, New York City, October 20, 2011 mjflynn@travelers.com](https://reader033.vdocument.in/reader033/viewer/2022061004/60b2720d0970ad37df32d479/html5/thumbnails/25.jpg)
25
And return SAS data to R on desktop
![Page 26: Creating more Analytical Bandwidth with R...Creating more Analytical Bandwidth with R Matthew J. Flynn, PhD Predictive Analytics World, New York City, October 20, 2011 mjflynn@travelers.com](https://reader033.vdocument.in/reader033/viewer/2022061004/60b2720d0970ad37df32d479/html5/thumbnails/26.jpg)
26
r2SAS v0.1 – to do’s – a lot
Add error checking (current very little) Perhaps a GUI in R to submit code for demo Submit local SAS program file on remote sever Return SAS output as HTML/PDF/etc – (requires Creating a SAS result package) Async submit Return a graph from JMP to R Return R data directly to SAS Better model examples Your suggestion here…
![Page 28: Creating more Analytical Bandwidth with R...Creating more Analytical Bandwidth with R Matthew J. Flynn, PhD Predictive Analytics World, New York City, October 20, 2011 mjflynn@travelers.com](https://reader033.vdocument.in/reader033/viewer/2022061004/60b2720d0970ad37df32d479/html5/thumbnails/28.jpg)
28
Appendix – resources
![Page 29: Creating more Analytical Bandwidth with R...Creating more Analytical Bandwidth with R Matthew J. Flynn, PhD Predictive Analytics World, New York City, October 20, 2011 mjflynn@travelers.com](https://reader033.vdocument.in/reader033/viewer/2022061004/60b2720d0970ad37df32d479/html5/thumbnails/29.jpg)
29
Appendix – resources
# NESUG 2010 Multiple Methods in JMP® to Interact with R # http://www.nesug.org/Proceedings/nesug10/po/po06.pdf # NESUG 2009 Automating JMP via Scripting tools and MS Windows COM # http://www.nesug.org/Proceedings/nesug09/ap/ap09.pdf # Usage Note 11089: How to enable JMP as a single use server for automation # http://www.jmp.com/support/notes/11/089.html # See also: # # GetObject and CreateObject behavior of Office automation servers # http://support.microsoft.com/kb/288902 # How to obtain the window handle for an Office Automation server # http://support.microsoft.com/kb/258511 # http://communities.sas.com/message/47978#47978