Introduction to S-Plus by Francesco Ferretti Analysis of Biological Data Course Winter term 2007 Dalhousie University.

Slides:



Advertisements
Similar presentations
Summary Statistics/Simple Graphs in SAS/EXCEL/JMP.
Advertisements

Introduction to Computers Section 6A. home The Operating System (OS) The operating system (OS) is software that controls the interaction between hardware.
Introduction to Visual Basic.NET Uploaded By: M.Sheraz anjum.
Ann Arbor ASA ‘Up and Running’ Series: SPSS Prepared by volunteers of the Ann Arbor Chapter of the American Statistical Association, in cooperation with.
Introduction to MATLAB Week 13 – 4/21/09. Instructor: Kate Musgrave Time: Tuesdays 3-5pm Office Hours: Tuesdays 1:30-3pm
Introduction to computers & Visual Basic School of Business Eastern Illinois University © Abdou Illia, Spring 2003 (Week 3, Monday 1/27/2003)
Update the PATH variable Trying to run the command: “javac Ex1.java” you’ve may encountered the error: “javac is not recognized as internal or external.
1 Chapter 20 — Creating Web Projects Microsoft Visual Basic.NET, Introduction to Programming.
Introduction to SPSS Short Courses Last created (Feb, 2008) Kentaka Aruga.
What is R Muhammad Omer. What is R  R is the programing language software for statistical computing and data analysis  The R language is extensively.
Engineering H192 - Computer Programming The Ohio State University Gateway Engineering Education Coalition Lect 4P. 1Winter Quarter Introduction to UNIX.
XP New Perspectives on Microsoft Access 2002 Tutorial 71 Microsoft Access 2002 Tutorial 7 – Integrating Access With the Web and With Other Programs.
Access Tutorial 10 Automating Tasks with Macros
Digital Image Processing Lecture3: Introduction to MATLAB.
Visual Basic 2008 Express Edition The IDE. Visual Basic 2008 Express The Start Page Recent Projects Open an existing project Create a New Project.
Project 3 File, Document, Folder Management, Windows XP Explorer Windows XP Service Pack 2 Edition Comprehensive Concepts and Techniques.
4 1 Operating System Activities  An operating system is a type of system software that acts as the master controller for all activities that take place.
An Introduction to Visual Basic
In Business Series © Prentice Hall Microsoft Office Excel 2007 In Business Core Chapter 1 Introduction.
Social Science Research Design and Statistics, 2/e Alfred P. Rovai, Jason D. Baker, and Michael K. Ponton Modifying Syntax PowerPoint Prepared by Alfred.
Ch 101 Chapter 10 Introduction to Batch Files. Ch 102 Overview A batch file is a text file that contains an ordered series of commands.
Introduction To Windows Operating Systems Manipulating Windows GUI
Workbench Overview Dwight Deugo Nesa Matic
Introduction to R Lecture 1: Getting Started Andrew Jaffe 8/30/10.
Piotr Wolski Introduction to R. Topics What is R? Sample session How to install R? Minimum you have to know to work in R Data objects in R and how to.
Using the ‘R’ Language for Bioinformatics
1 Computer Programming (ECGD2102 ) Using MATLAB Instructor: Eng. Eman Al.Swaity Lecture (1): Introduction.
SAS lecture - week 31 Some Basics of CQUEST The operating system in the ESC lab (1046) is Linux. The operating system in RW labs (107/109 and 211) is Windows.
T U T O R I A L  2009 Pearson Education, Inc. All rights reserved. 1 3 Welcome Application Introduction to Visual Programming.
Creating Graphical User Interfaces (GUI’s) with MATLAB By Jeffrey A. Webb OSU Gateway Coalition Member.
Visual Basic.NET BASICS Lesson 1 A First Look at Microsoft Visual Basic.NET.
Microsoft Visual Basic 2005 BASICS Lesson 1 A First Look at Microsoft Visual Basic.
Introduction to R Introductions What is R? RStudio Layout Summary Statistics Your First R Graph 17 September 2014 Sherubtse Training.
Lecture 20: Choosing the Right Tool for the Job. What is MATLAB? MATLAB is one of a number of commercially available, sophisticated mathematical computation.
COMPUTER SOFTWARE FORM 1. Learning Area Introduction to computer software Operating System (OS) Application Software Word Processing Software Presentation.
An Introduction to Forms. The Major Steps of a MicroSoft Access Database  Tables  Queries  Forms  Macros  Reports  Modules On our road map, we are.
Mantid Manipulation and Analysis Toolkit for ISIS data.
Computer Graphics Lecture 02 Fasih ur Rehman. Last Class Introduction to Computer Graphics Areas Application.
® IBM Software Group © 2007 IBM Corporation Module 1: Getting Started with Rational Software Architect Essentials of Modeling with IBM Rational Software.
PROGRAMMING IN R Introduction to R. In this session I will: Introduce you to the R program and windows Show how to install R Write basic programs in R.
Introduction to CADStat. CADStat and R R is a powerful and free statistical package [
Math 252: Math Modeling Eli Goldwyn Introduction to MATLAB.
Introduction to Programming on MATLAB Ecological Modeling Course Sep 11th, 2006.
Module 2 Part II Introduction To Windows Operating Systems Manipulating Windows GUI Introduction To Windows Operating Systems Manipulating Windows GUI.
TI-83 Plus. GraphLink: an interface helps us to exchange data between a PC and the TI- calculators.
1 EPIB 698C Lecture 1 Instructor: Raul Cruz-Cano
C Copyright © 2009, Oracle. All rights reserved. Using SQL Developer.
Chapter 2 – Introduction to Windows Operating System II Manipulating Windows GUI 1CMPF112 Computing Skills for Engineers.
Fundamentals of Windows Mouse n 4 Basic Operations: –Pointing –Clicking –Double Clicking –Dragging.
Dive Into® Visual Basic 2010 Express
R Brown-Bag Seminar 2.1 Topic: Introduction to R Presenter: Faith Musili ICRAF-Geoscience Lab.
Visual Basic Code & No.: CS 218
Introduction to Matlab
By Dr. Madhukar H. Dalvi Nagindas Khandwala college
An Introduction to Computers and Visual Basic
MATLAB Basics Nafees Ahmed Asstt. Professor, EE Deptt DIT, DehraDun.
DEPARTMENT OF COMPUTER SCIENCE
R Programming.
An Introduction to Computers and Visual Basic
MATLAB – What Is It ? Name is from matrix laboratory Powerful tool for
MATLAB – What Is It ? Name is from matrix laboratory Powerful tool for
Code is on the Website Outline Comparison of Excel and R
Download: Vensim Download:
Digital Image Processing
An Introduction to Computers and Visual Basic
Tutorial 7 – Integrating Access With the Web and With Other Programs
Basic Concepts of The User Interface
Using R for Data Analysis and Data Visualization
Introduction To MATLAB
Microsoft Windows 7 Basics
Presentation transcript:

Introduction to S-Plus by Francesco Ferretti Analysis of Biological Data Course Winter term 2007 Dalhousie University

Introduction  S-plus and R are statistical programs using the S language.  Developed in the Bell Labs of AT&T in 1970s by Rick Becker, John Chambers and Allan Wilks  In 1987 Douglas Martin at the University of Washington created the present Insightful Corporation. He made S more popular, compatible with many hardware platforms, and provided with the necessary support for technical and statistical problems. S become S-plus  In 1997 the R project started. It was created by Ross Ihaka and Robert Gentelman at the university of Auckland, New Zealand. R is Similar to S-plus and freely available.

S-Plus and R  Flexible and powerful statistical program  Particularly appealing for its graphical capabilities  Can be problematic with large amount of data SAS is more powerful in these cases

GUI (Grafical User Interface)  Main toolbar and several windows  Object Explorer Overview of what is available on the system. Computational Engine  data frames, list, matrices, vectors Interface Objects  Search path, menu items, toolbars, dialogs Documet objects – Outputs  Graph sheets, Scripts and Reports Object explorer visualize all the objects you have in your work directory

GUI (Grafical User Interface)  Import data  File>Import Data>From file  Export data  File>Export Data>to file  chose among all the data frames present in your working directory, give location and extension  Creating graphs 1.Highlight a dataset in object explorer 2. Select variables (Ctrl-select) 3. Click on 2D plots 4. Chose the preferred graph type 5. Save graphs Default *.sgr (s-plus graph sheet) Eventually you can choose your preferred picture extension with File>Export Graph.. then specify location, name and extension then click OK

GUI (Grafical User Interface)  Summary statistics 1. From object explorer select a data frame 2. On the main toolbar select Statistics>Summary Statistics 3. Select data, variables and statistics to be shown then click OK

Programming mode Full potential and flexibility of S-plus. Highly recommended! While GUI can perform much of the S-Plus commands and functions, programming mode allows you to resolve potentially all problems you will encounter in data manipulation, analysis and plotting.  Command window Can be used step by step interactively Writing functions Using a text editor (notepad, emacs, editplus, etc.) or directly on the command line

Command line (the basic)  S-plus is case sensitive  # commenting sign  ? Call help  q() quit S-plus  <- assignment sign. This is to associate a value or a function to a variable name

Use of S-Plus in programming mode  Calculator */+-, =, log, exp, sqrt, ^, sin, cos Follow the same arithmetic rules */ before +- and () before */  Manipulate data  Fitting models to data  Plotting graphs

Logical Values  Boolean Values: True, False , <= (less than or equal to), >=, == (equal to), != (not equal to)  Conditional expressions and operators If, else, ifelse & (and) | (or)

Brackets  () to enclose arguments of functions and perform arithmetic calculations  [] indexing objects  x<-c(1,5,7,8) then x[3] = 7  {} to enclose groups of commands  Function bodies  If else statements  loops

S-plus common objects  Vector Ordered group of numbers or strings  X<-c(45,29,27)  z<-c(180,180,165)  y<-c(“Hall”,”Francesco”,”Sara”)  Matrix “rectangular layout of cells each one containing a value”  AH<-matrix(c(45,29,27,180,180,165),nrow = 3)  AH<-matrix(c(x,z),nrow=3 )  Array Multidimentional matrix  Data frame  AHP<-data.frame(x,z,y)  AHP<-data.frame(x,z,y,)  List group together data not having the same structure. Output or summary come out as list. You can access or use part of these output.

Functions  Set of commands performed on specified variables  Y<-mean(x) …or..y<-(x 1 +x 2 +x 3 +x 4 )/4..or.. y<-sum(x)/4..or..y<-sum(x)/length(x) You can build your own functions  In command line SD<-function(x){sqrt(var(x))} function will be saved in your working directory…..SD(x)

Functions  Creating a file with an s extension (file.s, sort of a library where you can store one ore more functions) Open and editor Write the function: # this function create the dataset “buddy” and # plot its variables one against the other buddy<-function(){ x<-c(2,3,5,6,8,10) y<-c(4,6,10,12,16,20) buddy<-data.frame(x,y) plot(buddy$x,buddy$y,xlab=“x”,ylab=“y”,type=“l”) print(buddy) } Save the file as an s file: c:\buddy.s Open the file with source(“c:\\buddy.s”) Access the funtion calling it as buddy() Function name arguments Body of the function, set of commands

Use of S-Plus in programming mode (Manipulation of data)  Dataset never ready for analyses Importing datasets: read.table() Subsetting object Creating new variables  seq(), rep(), sort(), unique(), length() Merging and binding datasets:  merge(), cbin(),rbin()

Graphical analysis  Plotting to the active device: s-plus window or file pdf.graph(file=“”,horizontal=“”) postscript(file=“”,horizontal=“”) graphsheet(file=“”,format=“”) Important functions: par(), plot(), hist(), boxplot(), pairs()

Fitting a model to data  Take SharkLife data  Summary of the data, summary()  EDA (Exploratory Data Analysis), pairs(), hist(), boxplot(), plot()  Fitting a linear regression model between Lmax and birth.size, model1<-lm()  Checking the model (using statistics and plots), summary(model), plot(model)

Programming mode  Script window Mode where you can write programs, run them and keep track of your operations for future work  File>New>Script File

Useful Reference Books  The Basic of S-Plus by Krause A. and Olson M.  Statistical computing with S-Plus by Crawley M.J.  Modern Applied Statistics with S-plus by Venables W.N. and Ripley B.D  …much more in the internet