IST 3108 Data Analysis and Graphics Using R Week 9

Size: px
Start display at page:

Download "IST 3108 Data Analysis and Graphics Using R Week 9"

Transcription

1 IST 3108 Data Analysis and Graphics Using R Week 9 Engin YILDIZTEPE, Ph.D 2017-Spring Introduction to Graphics >y <- rnorm(20) >plot (y) In R, pictures are presented in the active graphical device or window. When a graphical function is executed, R will open such a window. You can print directly from the graphics window, or choose to copy the graph to the clipboard.you can also resize the graph. A graph can also be saved in many other formats, pdf, bitmap, metafile, jpeg, postscript, png or TIFF. (File Save as (when the graphics window is active)) 2 1

2 Introduction to Graphics When you produce a new plot, the old one is lost. In MS Windows, you can save a history of your graphs by activating the Recording feature under the History menu (seen when the graphics window is active). You can access old graphs by using the Page Up and Page Down keys. You can simply open a new active graphics window by using the function windows() in Windows, X11() in Unix and quartz() on a Mac OS X. 3 The traditional graphics model - plot If a single vector object is given the values are plotted on the y-axis against the row numbers or index. >y <- rnorm(20) >plot (y) The type= argument controls the type of plot produced, as follows: plot(y, type="p") plot(y, type="l") plot(y, type="b") plot(y, type="h") plot(y, type= s") plot(y, type= n") 4 2

3 The traditional graphics model - plot The plot types are: "p" points (i.e. a scatterplot) "l" lines (i.e. a line plot) "b" both (points and lines) "o" points and lines overplotted "h" high-density needles "s" step function, horizontal step first "n" nothing (i.e. no plot contents) 5 The traditional graphics model plot types 6 3

4 The traditional graphics model plot types 7 Standard arguments > y <- rnorm(20) > plot(y, type="l", lwd=3) > plot(y, type="b", lwd=5) > plot(y, type="l", col="grey") > plot(y, type="l", col="red", lwd=5) > plot(y, type="l", lty="dashed") > plot(y, type="l", ylim=c(-4, 4)) > plot(y, type="l", ylim=c(-3, 3)) > plot(y, type="l", ylim=c(-3, 3), xlim=c(0,50)) 8 4

5 The traditional graphics model plot line types Line types can either be specified as an integer; 0 :blank, 1 :solid (default), 2 :dashed, 3 :dotted, 4 :dotdash, 5 :longdash, 6 :twodash or as one of the character strings "blank", "solid", "dashed", "dotted", "dotdash", "longdash 9 Plots of one or two variables If x and y are vectors, plot(x, y) produces a scatterplot of y against x Example: Plot of sin(x) y x 10 5

6 Plots of one or two variables Example; > x<-seq(1,10,length=100) > y<-sin(x) > plot(x, y, main = "Plot of sin(x)", type="l, col="blue", lwd=3) 11 Plots of one or two variables Using pressure dataset?pressure plot(pressure$temperature, pressure$pressure) plot(pressure ~ temperature, data=pressure) plot(pressure ~ temperature, data=pressure, type='l') 12 6

7 Exercise >plot (pressure$temperature, pressure$pressure, xlab = "Temperature (deg C)", ylab = "Pressure (mm of Hg)", main = "pressure data: Vapor Pressure of Mercury") > plot(mtcars$wt, mtcars$mpg, ylab = "miles per gallon", xlab = "Weight (lb/1000)", main="mtcars data: fuel consumption and weight", type="p", col="red", lwd=3) 13 Permanent changes: The par() function The par() function can be used to modify traditional graphics state settings by specifying a value via an argument with the appropriate setting name. The following code sets new values for the col and lty settings. >par(col="red", lty="dashed") >plot(y, type="l") # line is red and dashed y Index 14 7

8 Permanent changes: The par() function >par(mfrow = c(2, 2)) >plot(pressure ~ temperature, data=pressure) >plot(pressure ~ temperature, data=pressure, type="l") >plot(pressure ~ temperature, data=pressure, type="l", lty=1) >plot(pressure ~ temperature, data=pressure, type="b", lty=1) pressure temperature temperature pressure pressure pressure temperature temperature 15 Permanent changes: The par() function >par(mfrow=c(1,1), bg = "cornsilk") >plot(pressure ~ temperature, data=pressure) pressure temperature 16 8

9 The par () function - Example Std. Normal t df=1 t df=5 Density dt(x, 1) dt(x, 5) x value x x t df=10 t df=30 dt(x, 10) dt(x, 30) x x 17 The par () function - Example x <- seq(-4, 4, length=100) par(mfrow = c(2, 3), lty=1, lwd=3) plot(x, dnorm(x), type="l", xlab="x value",ylab="density", main="std. Normal") plot(x, dt(x,1), type="l", main="t df=1", col="red") plot(x, dt(x,5), type="l", main="t df=5", col="blue") plot(x, dt(x,10), type="l", main="t df=10", col="darkgreen") plot(x, dt(x,30), type="l", main="t df=30", col="gold") 18 9

10 The lines() function - Example Comparison of t Distributions Density Distributions df=1 df=5 df=10 df=30 norma x value 19 The lines() function - Example x <- seq(-4, 4, length=100) px <- dnorm(x) degf <- c(1, 5, 10, 30) colors <- c("red", "blue", "darkgreen", "gold,"black") labels <- c("df=1,"df=5,"df=10", "df=30,"normal") par(mfrow=c(1,1),lwd=2, lty=1, col="black") plot(x, px, type="l", lty=2, lwd=4,xlab= x value", ylab="density", main="comparison of t Distributions") 20 10

11 The lines() function - Example lines(x, dt(x,degf[1]), col=colors[1]) lines(x, dt(x,degf[2]), col=colors[2]) lines(x, dt(x,degf[3]), col=colors[3]) lines(x, dt(x,degf[4]), col=colors[4]) legend("topright", legend=labels,title="distributions", lwd=2, lty=c(1, 1, 1, 1, 2), col=colors) 21 boxplot Produce box-and-whisker plot(s) of the given (grouped) values. >boxplot(mtcars$mpg) >boxplot(mtcars$mpg,notch=t) >boxplot(mtcars$mpg~mtcars$cyl) >boxplot(mtcars$mpg~mtcars$cyl,main="milage by cyl", col=c("red", "blue", "gold")) 22 11

12 boxplot >boxplot(mtcars$mpg~mtcars$cyl,main="milage by cyl", xlab="milage", horizontal=true,col=c("red", "blue", "gold")) >boxplot(mtcars$mpg~mtcars$cyl,main="milage by Cyl",xlab="Milage", horizontal=true,col=terrain.colors(3)) >boxplot(mtcars$mpg~mtcars$cyl,main="milage by Cyl",xlab="Milage", horizontal=true,col=rainbow(3)) 23 Histogram The generic function hist computes a histogram of the given data values. y<-rnorm(1000) hist(y) Histogram of y Frequency y 24 12

13 > hist(y,breaks="scott") Histogram > hist(y,breaks="fd") > hist(y,breaks="sturges") 25 Histogram > hist(y,breaks=seq(-4,4,0.1)) Histogram of y Frequency y 26 13

14 Histogram > hist(y,breaks=50,col="tomato") Histogram of y Frequency y 27 Histogram > hist(y,breaks=20,col=colors()) Histogram of y Frequency y 28 14

15 Histogram y için histogram Frekanslar y değerleri 29 Histogram 30 15

16 pie Draw a pie chart. >x<-c(14, 34, 20, 10, 22,40) >names(x)<-c( A, B, C, D, E, F ) >pie(x,main = "Energy Consumption", col=rainbow(6)) Energy Consumption B D C A E F 31 pie >pie(x,main = "Energy Consumption", col=rainbow(6),init.angle=110,clockwise=t) Energy Consumption A F B E D C 32 16

17 barplot Creates a bar plot with vertical or horizontal bars >barplot(x, ylim = c(0, 40),col = rainbow(6), main = "Energy Consumption, ylab = "Percent in Category") Energy Consumption Percent in Category A B C D E F 33 barplot >barplot(x, xlim = c(0, 40),col = rainbow(6), main = "Energy Consumption", ylab = "Percent in Category", horiz=t) Energy Consumption Percent in Category A B C D E F

18 barplot >barplot(x, ylim = c(0, 40), xlim=c(0,8), col=rainbow(6), main="energy Consumption", ylab="percent in Category", axis.lty=1, legend=names(x)) Energy Consumption Percent in Category A B C D E F A B C D E F 35 example How can we draw this pie chart? 36 18

19 curve function Draws a curve corresponding to a function over the interval [from, to]. curve(expr, from = NULL, to = NULL, ) >curve(dnorm(x,m=10,sd=2), from=0, to=20, main= "Normal distribution") Normal distribution dnorm(x, m = 10, sd = 2) x 37 curve function >curve(dgamma(x, scale=1.5, shape=2),from=0, to=15, main="gamma distribution") 38 19

20 curve function >curve(dweibull(x, scale=2.5, shape=1.5),from=0, to=15, main="weibull distribution") 39 qqnorm - qqline This plot is used to determine if your data is close to being normally distributed. You cannot be sure that the data is normally distributed, but you can rule out if it is not normally distributed. y<-rnorm(1000,mean=10,sd=2) qqnorm(y) Normal Q-Q Plot qqline(y,col=2) Sample Quantiles Theoretical Quantiles 40 20

21 qqnorm - qqline x.wei<-rweibull(n=200,shape=2.2,scale=1.2) qqnorm(x.wei) qqline(x.wei,col=2) Normal Q-Q Plot Sample Quantiles Theoretical Quantiles 41 21

Statistical Programming with R

Statistical Programming with R Statistical Programming with R Lecture 9: Basic graphics in R Part 2 Bisher M. Iqelan biqelan@iugaza.edu.ps Department of Mathematics, Faculty of Science, The Islamic University of Gaza 2017-2018, Semester

More information

Intro to R Graphics Center for Social Science Computation and Research, 2010 Stephanie Lee, Dept of Sociology, University of Washington

Intro to R Graphics Center for Social Science Computation and Research, 2010 Stephanie Lee, Dept of Sociology, University of Washington Intro to R Graphics Center for Social Science Computation and Research, 2010 Stephanie Lee, Dept of Sociology, University of Washington Class Outline - The R Environment and Graphics Engine - Basic Graphs

More information

Az R adatelemzési nyelv

Az R adatelemzési nyelv Az R adatelemzési nyelv alapjai II. Egészségügyi informatika és biostatisztika Gézsi András gezsi@mit.bme.hu Functions Functions Functions do things with data Input : function arguments (0,1,2, ) Output

More information

CIND123 Module 6.2 Screen Capture

CIND123 Module 6.2 Screen Capture CIND123 Module 6.2 Screen Capture Hello, everyone. In this segment, we will discuss the basic plottings in R. Mainly; we will see line charts, bar charts, histograms, pie charts, and dot charts. Here is

More information

Using Built-in Plotting Functions

Using Built-in Plotting Functions Workshop: Graphics in R Katherine Thompson (katherine.thompson@uky.edu Department of Statistics, University of Kentucky September 15, 2016 Using Built-in Plotting Functions ## Plotting One Quantitative

More information

R Workshop Module 3: Plotting Data Katherine Thompson Department of Statistics, University of Kentucky

R Workshop Module 3: Plotting Data Katherine Thompson Department of Statistics, University of Kentucky R Workshop Module 3: Plotting Data Katherine Thompson (katherine.thompson@uky.edu Department of Statistics, University of Kentucky October 15, 2013 Reading in Data Start by reading the dataset practicedata.txt

More information

Graphics in R STAT 133. Gaston Sanchez. Department of Statistics, UC Berkeley

Graphics in R STAT 133. Gaston Sanchez. Department of Statistics, UC Berkeley Graphics in R STAT 133 Gaston Sanchez Department of Statistics, UC Berkeley gastonsanchez.com github.com/gastonstat/stat133 Course web: gastonsanchez.com/stat133 Base Graphics 2 Graphics in R Traditional

More information

Advanced Graphics with R

Advanced Graphics with R Advanced Graphics with R Paul Murrell Universitat de Barcelona April 30 2009 Session overview: (i) Introduction Graphic formats: Overview and creating graphics in R Graphical parameters in R: par() Selected

More information

Types of Plotting Functions. Managing graphics devices. Further High-level Plotting Functions. The plot() Function

Types of Plotting Functions. Managing graphics devices. Further High-level Plotting Functions. The plot() Function 3 / 23 5 / 23 Outline The R Statistical Environment R Graphics Peter Dalgaard Department of Biostatistics University of Copenhagen January 16, 29 1 / 23 2 / 23 Overview Standard R Graphics The standard

More information

Introduction to R: Day 2 September 20, 2017

Introduction to R: Day 2 September 20, 2017 Introduction to R: Day 2 September 20, 2017 Outline RStudio projects Base R graphics plotting one or two continuous variables customizable elements of plots saving plots to a file Create a new project

More information

Graphics - Part III: Basic Graphics Continued

Graphics - Part III: Basic Graphics Continued Graphics - Part III: Basic Graphics Continued Statistics 135 Autumn 2005 Copyright c 2005 by Mark E. Irwin Highway MPG 20 25 30 35 40 45 50 y^i e i = y i y^i 2000 2500 3000 3500 4000 Car Weight Copyright

More information

INTRODUCTION TO R. Basic Graphics

INTRODUCTION TO R. Basic Graphics INTRODUCTION TO R Basic Graphics Graphics in R Create plots with code Replication and modification easy Reproducibility! graphics package ggplot2, ggvis, lattice graphics package Many functions plot()

More information

An Introduction to R 2.2 Statistical graphics

An Introduction to R 2.2 Statistical graphics An Introduction to R 2.2 Statistical graphics Dan Navarro (daniel.navarro@adelaide.edu.au) School of Psychology, University of Adelaide ua.edu.au/ccs/people/dan DSTO R Workshop, 29-Apr-2015 Scatter plots

More information

AA BB CC DD EE. Introduction to Graphics in R

AA BB CC DD EE. Introduction to Graphics in R Introduction to Graphics in R Cori Mar 7/10/18 ### Reading in the data dat

More information

Making plots in R [things I wish someone told me when I started grad school]

Making plots in R [things I wish someone told me when I started grad school] Making plots in R [things I wish someone told me when I started grad school] Kirk Lohmueller Department of Ecology and Evolutionary Biology UCLA September 22, 2017 In honor of Talk Like a Pirate Day...

More information

R Visualizing Data. Fall Fall 2016 CS130 - Intro to R 1

R Visualizing Data. Fall Fall 2016 CS130 - Intro to R 1 R Visualizing Data Fall 2016 Fall 2016 CS130 - Intro to R 1 mtcars Data Frame R has a built-in data frame called mtcars Useful R functions length(object) # number of variables str(object) # structure of

More information

Statistics 251: Statistical Methods

Statistics 251: Statistical Methods Statistics 251: Statistical Methods Summaries and Graphs in R Module R1 2018 file:///u:/documents/classes/lectures/251301/renae/markdown/master%20versions/summary_graphs.html#1 1/14 Summary Statistics

More information

DSCI 325: Handout 18 Introduction to Graphics in R

DSCI 325: Handout 18 Introduction to Graphics in R DSCI 325: Handout 18 Introduction to Graphics in R Spring 2016 This handout will provide an introduction to creating graphics in R. One big advantage that R has over SAS (and over several other statistical

More information

Stats with R and RStudio Practical: basic stats for peak calling Jacques van Helden, Hugo varet and Julie Aubert

Stats with R and RStudio Practical: basic stats for peak calling Jacques van Helden, Hugo varet and Julie Aubert Stats with R and RStudio Practical: basic stats for peak calling Jacques van Helden, Hugo varet and Julie Aubert 2017-01-08 Contents Introduction 2 Peak-calling: question...........................................

More information

Spring 2017 CS130 - Intro to R 1 R VISUALIZING DATA. Spring 2017 CS130 - Intro to R 2

Spring 2017 CS130 - Intro to R 1 R VISUALIZING DATA. Spring 2017 CS130 - Intro to R 2 Spring 2017 CS130 - Intro to R 1 R VISUALIZING DATA Spring 2017 Spring 2017 CS130 - Intro to R 2 Goals for this lecture: Review constructing Data Frame, Categorizing variables Construct basic graph, learn

More information

Dr. Junchao Xia Center of Biophysics and Computational Biology. Fall /6/ /13

Dr. Junchao Xia Center of Biophysics and Computational Biology. Fall /6/ /13 BIO5312 Biostatistics R Session 02: Graph Plots in R Dr. Junchao Xia Center of Biophysics and Computational Biology Fall 2016 9/6/2016 1 /13 Graphic Methods Graphic methods of displaying data give a quick

More information

Chapter 5 An Introduction to Basic Plotting Tools

Chapter 5 An Introduction to Basic Plotting Tools Chapter 5 An Introduction to Basic Plotting Tools We have demonstrated the use of R tools for importing data, manipulating data, extracting subsets of data, and making simple calculations, such as mean,

More information

Advanced Econometric Methods EMET3011/8014

Advanced Econometric Methods EMET3011/8014 Advanced Econometric Methods EMET3011/8014 Lecture 2 John Stachurski Semester 1, 2011 Announcements Missed first lecture? See www.johnstachurski.net/emet Weekly download of course notes First computer

More information

GS Analysis of Microarray Data

GS Analysis of Microarray Data GS01 0163 Analysis of Microarray Data Keith Baggerly and Kevin Coombes Section of Bioinformatics Department of Biostatistics and Applied Mathematics UT M. D. Anderson Cancer Center kabagg@mdanderson.org

More information

Common Sta 101 Commands for R. 1 One quantitative variable. 2 One categorical variable. 3 Two categorical variables. Summary statistics

Common Sta 101 Commands for R. 1 One quantitative variable. 2 One categorical variable. 3 Two categorical variables. Summary statistics Common Sta 101 Commands for R 1 One quantitative variable summary(x) # most summary statitstics at once mean(x) median(x) sd(x) hist(x) boxplot(x) # horizontal = TRUE for horizontal plot qqnorm(x) qqline(x)

More information

Module 10. Data Visualization. Andrew Jaffe Instructor

Module 10. Data Visualization. Andrew Jaffe Instructor Module 10 Data Visualization Andrew Jaffe Instructor Basic Plots We covered some basic plots on Wednesday, but we are going to expand the ability to customize these basic graphics first. 2/37 But first...

More information

Install RStudio from - use the standard installation.

Install RStudio from   - use the standard installation. Session 1: Reading in Data Before you begin: Install RStudio from http://www.rstudio.com/ide/download/ - use the standard installation. Go to the course website; http://faculty.washington.edu/kenrice/rintro/

More information

Statistical Software Camp: Introduction to R

Statistical Software Camp: Introduction to R Statistical Software Camp: Introduction to R Day 1 August 24, 2009 1 Introduction 1.1 Why Use R? ˆ Widely-used (ever-increasingly so in political science) ˆ Free ˆ Power and flexibility ˆ Graphical capabilities

More information

STATISTICS: AN INTRODUCTION USING R. By M.J. Crawley. Exercises 1. PLOTS: GRAPHICAL METHODS OF DATA EXPLORATION

STATISTICS: AN INTRODUCTION USING R. By M.J. Crawley. Exercises 1. PLOTS: GRAPHICAL METHODS OF DATA EXPLORATION STATISTICS: AN INTRODUCTION USING R By M.J. Crawley Exercises 1. PLOTS: GRAPHICAL METHODS OF DATA EXPLORATION Producing high quality graphs is one of the main reasons for doing statistical computing. There

More information

Introduction to R. Biostatistics 615/815 Lecture 23

Introduction to R. Biostatistics 615/815 Lecture 23 Introduction to R Biostatistics 615/815 Lecture 23 So far We have been working with C Strongly typed language Variable and function types set explicitly Functional language Programs are a collection of

More information

Common R commands used in Data Analysis and Statistical Inference

Common R commands used in Data Analysis and Statistical Inference Common R commands used in Data Analysis and Statistical Inference 1 One numerical variable summary(x) # most summary statitstics at once mean(x) median(x) sd(x) hist(x) boxplot(x) # horizontal = TRUE for

More information

R Graph Essentials. Use R's powerful graphing capabilities to design and create professional-level graphics. David Alexander Lillis

R Graph Essentials. Use R's powerful graphing capabilities to design and create professional-level graphics. David Alexander Lillis R Graph Essentials Use R's powerful graphing capabilities to design and create professional-level graphics David Alexander Lillis BIRMINGHAM - MUMBAI R Graph Essentials Copyright 2014 Packt Publishing

More information

The nor1mix Package. August 3, 2006

The nor1mix Package. August 3, 2006 The nor1mix Package August 3, 2006 Title Normal (1-d) Mixture Models (S3 Classes and Methods) Version 1.0-6 Date 2006-08-02 Author: Martin Mächler Maintainer Martin Maechler

More information

An Introduction to R Graphics with examples

An Introduction to R Graphics with examples An Introduction to R Graphics with examples Feng Li November 18, 2008 1 R graphics system A picture is worth a thousand words! The R graphics system can be broken into four distinct levels: graphics packages;

More information

Introduction Basics Simple Statistics Graphics. Using R for Data Analysis and Graphics. 4. Graphics

Introduction Basics Simple Statistics Graphics. Using R for Data Analysis and Graphics. 4. Graphics Using R for Data Analysis and Graphics 4. Graphics Overview 4.1 Overview Several R graphics functions have been presented so far: > plot(d.sport[,"kugel"], d.sport[,"speer"], + xlab="ball push", ylab="javelin",

More information

Visualizing in R advanced plotting

Visualizing in R advanced plotting Visualizing in R advanced plotting Norsk statistikermøte, Halden, 10. juni 2013 Elisabeth Orskaug Thordis Thorarinsdottir Norsk Regnesentral 1 / 22 Outline of the lectures Monday Lecture I: Basic plotting

More information

Statistical Programming Camp: An Introduction to R

Statistical Programming Camp: An Introduction to R Statistical Programming Camp: An Introduction to R Handout 3: Data Manipulation and Summarizing Univariate Data Fox Chapters 1-3, 7-8 In this handout, we cover the following new materials: ˆ Using logical

More information

Package visualizationtools

Package visualizationtools Package visualizationtools April 12, 2011 Type Package Title Package contains a few functions to visualize statistical circumstances. Version 0.2 Date 2011-04-06 Author Thomas Roth Etienne Stockhausen

More information

Configuring Figure Regions with prepplot Ulrike Grömping 03 April 2018

Configuring Figure Regions with prepplot Ulrike Grömping 03 April 2018 Configuring Figure Regions with prepplot Ulrike Grömping 3 April 218 Contents 1 Purpose and concept of package prepplot 1 2 Overview of possibilities 2 2.1 Scope.................................................

More information

Solution to Tumor growth in mice

Solution to Tumor growth in mice Solution to Tumor growth in mice Exercise 1 1. Import the data to R Data is in the file tumorvols.csv which can be read with the read.csv2 function. For a succesful import you need to tell R where exactly

More information

Introduction to RStudio

Introduction to RStudio First, take class through processes of: Signing in Changing password: Tools -> Shell, then use passwd command Installing packages Check that at least these are installed: MASS, ISLR, car, class, boot,

More information

Data Visualization. Andrew Jaffe Instructor

Data Visualization. Andrew Jaffe Instructor Module 9 Data Visualization Andrew Jaffe Instructor Basic Plots We covered some basic plots previously, but we are going to expand the ability to customize these basic graphics first. 2/45 Read in Data

More information

Stat 290: Lab 2. Introduction to R/S-Plus

Stat 290: Lab 2. Introduction to R/S-Plus Stat 290: Lab 2 Introduction to R/S-Plus Lab Objectives 1. To introduce basic R/S commands 2. Exploratory Data Tools Assignment Work through the example on your own and fill in numerical answers and graphs.

More information

Introduction to R. Richard Wang, PhD CBI fellow Nelson & Miceli labs

Introduction to R. Richard Wang, PhD CBI fellow Nelson & Miceli labs Introduction to R Richard Wang, PhD CBI fellow Nelson & Miceli labs Workshop 3: Introduction to R Day 2 Statistical methods Probability distributions Random number generation Common statistical tests Fisher

More information

The nor1mix Package. June 12, 2007

The nor1mix Package. June 12, 2007 The nor1mix Package June 12, 2007 Title Normal (1-d) Mixture Models (S3 Classes and Methods) Version 1.0-7 Date 2007-03-15 Author Martin Mächler Maintainer Martin Maechler

More information

R is a programming language of a higher-level Constantly increasing amount of packages (new research) Free of charge Website:

R is a programming language of a higher-level Constantly increasing amount of packages (new research) Free of charge Website: Introduction to R R R is a programming language of a higher-level Constantly increasing amount of packages (new research) Free of charge Website: http://www.r-project.org/ Code Editor: http://rstudio.org/

More information

R Graphics. Feng Li School of Statistics and Mathematics Central University of Finance and Economics

R Graphics. Feng Li School of Statistics and Mathematics Central University of Finance and Economics R Graphics Feng Li feng.li@cufe.edu.cn School of Statistics and Mathematics Central University of Finance and Economics Revised on June 2, 2015 Today we are going to learn... 1 Basic R Graphical System

More information

GS Analysis of Microarray Data

GS Analysis of Microarray Data GS01 0163 Analysis of Microarray Data Keith Baggerly and Bradley Broom Department of Bioinformatics and Computational Biology UT M. D. Anderson Cancer Center kabagg@mdanderson.org bmbroom@mdanderson.org

More information

Using R. Liang Peng Georgia Institute of Technology January 2005

Using R. Liang Peng Georgia Institute of Technology January 2005 Using R Liang Peng Georgia Institute of Technology January 2005 1. Introduction Quote from http://www.r-project.org/about.html: R is a language and environment for statistical computing and graphics. It

More information

Chapter 2: Descriptive Statistics: Tabular and Graphical Methods

Chapter 2: Descriptive Statistics: Tabular and Graphical Methods Chapter 2: Descriptive Statistics: Tabular and Graphical Methods Example 1 C2_1

More information

Introduction to R for Epidemiologists

Introduction to R for Epidemiologists Introduction to R for Epidemiologists Jenna Krall, PhD Thursday, January 29, 2015 Final project Epidemiological analysis of real data Must include: Summary statistics T-tests or chi-squared tests Regression

More information

An introduction to WS 2015/2016

An introduction to WS 2015/2016 An introduction to WS 2015/2016 Dr. Noémie Becker (AG Metzler) Dr. Sonja Grath (AG Parsch) Special thanks to: Prof. Dr. Martin Hutzenthaler (previously AG Metzler, now University of Duisburg-Essen) course

More information

Plotting Complex Figures Using R. Simon Andrews v

Plotting Complex Figures Using R. Simon Andrews v Plotting Complex Figures Using R Simon Andrews simon.andrews@babraham.ac.uk v2017-11 The R Painters Model Plot area Base plot Overlays Core Graph Types Local options to change a specific plot Global options

More information

Univariate Data - 2. Numeric Summaries

Univariate Data - 2. Numeric Summaries Univariate Data - 2. Numeric Summaries Young W. Lim 2018-08-01 Mon Young W. Lim Univariate Data - 2. Numeric Summaries 2018-08-01 Mon 1 / 36 Outline 1 Univariate Data Based on Numerical Summaries R Numeric

More information

Introduction to R for Beginners, Level II. Jeon Lee Bio-Informatics Core Facility (BICF), UTSW

Introduction to R for Beginners, Level II. Jeon Lee Bio-Informatics Core Facility (BICF), UTSW Introduction to R for Beginners, Level II Jeon Lee Bio-Informatics Core Facility (BICF), UTSW Basics of R Powerful programming language and environment for statistical computing Useful for very basic analysis

More information

Namir s R 102 Plotting Tutorial by Namir Shammas Dedication

Namir s R 102 Plotting Tutorial by Namir Shammas Dedication Page 1 by Namir Shammas Dedication This tutorial is dedicated to memory of my uncles and father A Shammas generation that has passed on. Table of Contents Introduction... 2 Before You Start... 3 Simple

More information

Package kofnga. November 24, 2015

Package kofnga. November 24, 2015 Type Package Package kofnga November 24, 2015 Title A Genetic Algorithm for Fixed-Size Subset Selection Version 1.2 Date 2015-11-24 Author Mark A. Wolters Maintainer Mark A. Wolters

More information

Package gains. September 12, 2017

Package gains. September 12, 2017 Package gains September 12, 2017 Version 1.2 Date 2017-09-08 Title Lift (Gains) Tables and Charts Author Craig A. Rolling Maintainer Craig A. Rolling Depends

More information

LAB #1: DESCRIPTIVE STATISTICS WITH R

LAB #1: DESCRIPTIVE STATISTICS WITH R NAVAL POSTGRADUATE SCHOOL LAB #1: DESCRIPTIVE STATISTICS WITH R Statistics (OA3102) Lab #1: Descriptive Statistics with R Goal: Introduce students to various R commands for descriptive statistics. Lab

More information

Univariate Data - 2. Numeric Summaries

Univariate Data - 2. Numeric Summaries Univariate Data - 2. Numeric Summaries Young W. Lim 2018-02-05 Mon Young W. Lim Univariate Data - 2. Numeric Summaries 2018-02-05 Mon 1 / 31 Outline 1 Univariate Data Based on Numerical Summaries Young

More information

Computer Statistics with R

Computer Statistics with R MAREK GAGOLEWSKI KONSTANCJA BOBECKA-WESO LOWSKA PRZEMYS LAW GRZEGORZEWSKI Computer Statistics with R 2. Exploratory Data Analysis (Descriptive Statistics) Faculty of Mathematics and Information Science

More information

Lab 4: Distributions of random variables

Lab 4: Distributions of random variables Lab 4: Distributions of random variables In this lab we ll investigate the probability distribution that is most central to statistics: the normal distribution If we are confident that our data are nearly

More information

Plotting: An Iterative Process

Plotting: An Iterative Process Plotting: An Iterative Process Plotting is an iterative process. First we find a way to represent the data that focusses on the important aspects of the data. What is considered an important aspect may

More information

Tutorial 3: Probability & Distributions Johannes Karreth RPOS 517, Day 3

Tutorial 3: Probability & Distributions Johannes Karreth RPOS 517, Day 3 Tutorial 3: Probability & Distributions Johannes Karreth RPOS 517, Day 3 This tutorial shows you: how to simulate a random process how to plot the distribution of a variable how to assess the distribution

More information

Practice for Learning R and Learning Latex

Practice for Learning R and Learning Latex Practice for Learning R and Learning Latex Jennifer Pan August, 2011 Latex Environments A) Try to create the following equations: 1. 5+6 α = β2 2. P r( 1.96 Z 1.96) = 0.95 ( ) ( ) sy 1 r 2 3. ˆβx = r xy

More information

A (very) brief introduction to R

A (very) brief introduction to R A (very) brief introduction to R You typically start R at the command line prompt in a command line interface (CLI) mode. It is not a graphical user interface (GUI) although there are some efforts to produce

More information

The Basics of Plotting in R

The Basics of Plotting in R The Basics of Plotting in R R has a built-in Datasets Package: iris mtcars precip faithful state.x77 USArrests presidents ToothGrowth USJudgeRatings You can call built-in functions like hist() or plot()

More information

CS Introduction to Computational and Data Science. Instructor: Renzhi Cao Computer Science Department Pacific Lutheran University Spring 2017

CS Introduction to Computational and Data Science. Instructor: Renzhi Cao Computer Science Department Pacific Lutheran University Spring 2017 CS 133 - Introduction to Computational and Data Science Instructor: Renzhi Cao Computer Science Department Pacific Lutheran University Spring 2017 Announcement Read book for R control structure and function.

More information

Outline day 4 May 30th

Outline day 4 May 30th Graphing in R: basic graphing ggplot2 package Outline day 4 May 30th 05/2017 117 Graphing in R: basic graphing 05/2017 118 basic graphing Producing graphs R-base package graphics offers funcaons for producing

More information

R programming. 19 February, University of Trento - FBK 1 / 50

R programming. 19 February, University of Trento - FBK 1 / 50 R programming University of Trento - FBK 19 February, 2015 1 / 50 Hints on programming 1 Save all your commands in a SCRIPT FILE, they will be useful in future...no one knows... 2 Save your script file

More information

Package munfold. R topics documented: February 8, Type Package. Title Metric Unfolding. Version Date Author Martin Elff

Package munfold. R topics documented: February 8, Type Package. Title Metric Unfolding. Version Date Author Martin Elff Package munfold February 8, 2016 Type Package Title Metric Unfolding Version 0.3.5 Date 2016-02-08 Author Martin Elff Maintainer Martin Elff Description Multidimensional unfolding using

More information

Package simed. November 27, 2017

Package simed. November 27, 2017 Version 1.0.3 Title Simulation Education Author Barry Lawson, Larry Leemis Package simed November 27, 2017 Maintainer Barry Lawson Imports graphics, grdevices, methods, stats, utils

More information

Package OmicCircos. R topics documented: November 17, Version Date

Package OmicCircos. R topics documented: November 17, Version Date Version 1.16.0 Date 2015-02-23 Package OmicCircos November 17, 2017 Title High-quality circular visualization of omics data Author Maintainer Ying Hu biocviews Visualization,Statistics,Annotation

More information

R Bootcamp Part I (B)

R Bootcamp Part I (B) R Bootcamp Part I (B) An R Script is available to make it easy for you to copy/paste all the tutorial commands into RStudio: http://statistics.uchicago.edu/~collins/rbootcamp/rbootcamp1b_rcode.r Preliminaries:

More information

This document is designed to get you started with using R

This document is designed to get you started with using R An Introduction to R This document is designed to get you started with using R We will learn about what R is and its advantages over other statistics packages the basics of R plotting data and graphs What

More information

Basic Statistical Graphics in R. Stem and leaf plots 100,100,100,99,98,97,96,94,94,87,83,82,77,75,75,73,71,66,63,55,55,55,51,19

Basic Statistical Graphics in R. Stem and leaf plots 100,100,100,99,98,97,96,94,94,87,83,82,77,75,75,73,71,66,63,55,55,55,51,19 Basic Statistical Graphics in R. Stem and leaf plots Example. Create a vector of data titled exam containing the following scores: 100,100,100,99,98,97,96,94,94,87,83,82,77,75,75,73,71,66,63,55,55,55,51,19

More information

Graphics #1. R Graphics Fundamentals & Scatter Plots

Graphics #1. R Graphics Fundamentals & Scatter Plots Graphics #1. R Graphics Fundamentals & Scatter Plots In this lab, you will learn how to generate customized publication-quality graphs in R. Working with R graphics can be done as a stepwise process. Rather

More information

plot(seq(0,10,1), seq(0,10,1), main = "the Title", xlim=c(1,20), ylim=c(1,20), col="darkblue");

plot(seq(0,10,1), seq(0,10,1), main = the Title, xlim=c(1,20), ylim=c(1,20), col=darkblue); R for Biologists Day 3 Graphing and Making Maps with Your Data Graphing is a pretty convenient use for R, especially in Rstudio. plot() is the most generalized graphing function. If you give it all numeric

More information

Package npregfast. November 30, 2017

Package npregfast. November 30, 2017 Type Package Package npregfast November 30, 2017 Title Nonparametric Estimation of Regression Models with Factor-by-Curve Interactions Version 1.5.1 Date 2017-11-30 Maintainer Marta Sestelo

More information

Package sciplot. February 15, 2013

Package sciplot. February 15, 2013 Package sciplot February 15, 2013 Version 1.1-0 Title Scientific Graphing Functions for Factorial Designs Author Manuel Morales , with code developed by the R Development Core Team

More information

Middle Years Data Analysis Display Methods

Middle Years Data Analysis Display Methods Middle Years Data Analysis Display Methods Double Bar Graph A double bar graph is an extension of a single bar graph. Any bar graph involves categories and counts of the number of people or things (frequency)

More information

Applied Calculus. Lab 1: An Introduction to R

Applied Calculus. Lab 1: An Introduction to R 1 Math 131/135/194, Fall 2004 Applied Calculus Profs. Kaplan & Flath Macalester College Lab 1: An Introduction to R Goal of this lab To begin to see how to use R. What is R? R is a computer package for

More information

Welcome to Workshop: Making Graphs

Welcome to Workshop: Making Graphs Welcome to Workshop: Making Graphs I. Please sign in on the sign in sheet (so I can send you slides & follow up for feedback). II. Download materials you ll need from my website (http://faculty.washington.edu/jhrl/teaching.html

More information

Package splicegear. R topics documented: December 4, Title splicegear Version Author Laurent Gautier

Package splicegear. R topics documented: December 4, Title splicegear Version Author Laurent Gautier Title splicegear Version 1.51.0 Author Laurent Gautier Package splicegear December 4, 2017 A set of tools to work with alternative splicing Maintainer Laurent Gautier

More information

Package pwrrasch. R topics documented: September 28, Type Package

Package pwrrasch. R topics documented: September 28, Type Package Type Package Package pwrrasch September 28, 2015 Title Statistical Power Simulation for Testing the Rasch Model Version 0.1-2 Date 2015-09-28 Author Takuya Yanagida [cre, aut], Jan Steinfeld [aut], Thomas

More information

Introduction to R 21/11/2016

Introduction to R 21/11/2016 Introduction to R 21/11/2016 C3BI Vincent Guillemot & Anne Biton R: presentation and installation Where? https://cran.r-project.org/ How to install and use it? Follow the steps: you don t need advanced

More information

Stat 302 Statistical Software and Its Applications Density Estimation

Stat 302 Statistical Software and Its Applications Density Estimation Stat 302 Statistical Software and Its Applications Density Estimation Yen-Chi Chen Department of Statistics, University of Washington Spring 2017 1 / 42 Examples of Density Estimation 1 Histogram of faithful$eruptions

More information

Mixed models in R using the lme4 package Part 2: Lattice graphics

Mixed models in R using the lme4 package Part 2: Lattice graphics Mixed models in R using the lme4 package Part 2: Lattice graphics Douglas Bates University of Wisconsin - Madison and R Development Core Team University of Lausanne July 1,

More information

UP School of Statistics Student Council Education and Research

UP School of Statistics Student Council Education and Research w UP School of Statistics Student Council Education and Research erho.weebly.com 0 erhomyhero@gmail.com f /erhoismyhero t @erhomyhero S133_HOA_001 Statistics 133 Bayesian Statistical Inference Use of R

More information

Package glogis. R topics documented: March 16, Version Date

Package glogis. R topics documented: March 16, Version Date Version 1.0-1 Date 2018-03-16 Package glogis March 16, 2018 Title Fitting and Testing Generalized Logistic Distributions Description Tools for the generalized logistic distribution (Type I, also known

More information

R Graphs Cookbook. Hrishi V. Mittal BIRMINGHAM - MUMBAI.

R Graphs Cookbook. Hrishi V. Mittal BIRMINGHAM - MUMBAI. R Graphs Cookbook Detailed hands-on recipes for creating the most useful types of graphs in R starting from the simplest versions to more advanced applications Hrishi V. Mittal BIRMINGHAM - MUMBAI R Graphs

More information

Estimating R 0 : Solutions

Estimating R 0 : Solutions Estimating R 0 : Solutions John M. Drake and Pejman Rohani Exercise 1. Show how this result could have been obtained graphically without the rearranged equation. Here we use the influenza data discussed

More information

Data Visualization in R

Data Visualization in R Data Visualization in R L. Torgo ltorgo@fc.up.pt Faculdade de Ciências / LIAAD-INESC TEC, LA Universidade do Porto Oct, 216 Introduction Motivation for Data Visualization Humans are outstanding at detecting

More information

Lab1 Part 1: Exploratory Data Analysis & R Basics Big Data Analytics Feb5, 2018

Lab1 Part 1: Exploratory Data Analysis & R Basics Big Data Analytics Feb5, 2018 Lab1 Part 1: Exploratory Data Analysis & R Basics Big Data Analytics Feb5, 2018 Pre-requisites: R and R Studio installed. Preferred versions: R version 3.1.1 or above and R Studio 0.98.1062 or above; any

More information

Intro to R for Epidemiologists

Intro to R for Epidemiologists Lab 9 (3/19/15) Intro to R for Epidemiologists Part 1. MPG vs. Weight in mtcars dataset The mtcars dataset in the datasets package contains fuel consumption and 10 aspects of automobile design and performance

More information

Package ClamR. R topics documented: July 29, Type Package

Package ClamR. R topics documented: July 29, Type Package Type Package Package ClamR July 29, 2015 Title Time Series Modeling for Climate Change Proxies Version 2.1-1 Date 2015-07-27 Imports stats Author Jonathan M. Lees Maintainer Jonathan M. Lees

More information

Package OmicCircos. R topics documented: November 1, Version Date Title High-quality circular visualization of omic data

Package OmicCircos. R topics documented: November 1, Version Date Title High-quality circular visualization of omic data Package OmicCircos November 1, 2013 Version 1.0.0 Date 2013-05-28 Title High-quality circular visualization of omic data Author Maintainer Ying Hu biocviews Visualization,Statistics,Annotation

More information

8. MINITAB COMMANDS WEEK-BY-WEEK

8. MINITAB COMMANDS WEEK-BY-WEEK 8. MINITAB COMMANDS WEEK-BY-WEEK In this section of the Study Guide, we give brief information about the Minitab commands that are needed to apply the statistical methods in each week s study. They are

More information

Graph tool instructions and R code

Graph tool instructions and R code Graph tool instructions and R code 1) Prepare data: tab-delimited format Data need to be inputted in a tab-delimited format. This can be easily achieved by preparing the data in a spread sheet program

More information

Package Daim. February 15, 2013

Package Daim. February 15, 2013 Package Daim February 15, 2013 Version 1.0.0 Title Diagnostic accuracy of classification models. Author Sergej Potapov, Werner Adler and Berthold Lausen. Several functions for evaluating the accuracy of

More information