SlideShare a Scribd company logo
STATISTICAL COMPUTATION
USING R
 Introduction
 R as a statistical software
 Statistical features
 R preliminaries
 Functions in R
 Graphics in R
 Distributions
 Conclusion
 References
Introduction
 programming language and software environment
for statistical computing and graphics.
 S,S PLUS.
 Developed by Ross Ihaka and Robert Gentleman at
the University of Auckland, New Zealand.
 Open source software
 R works fundamentally by the question-and-answer
model
 Can be downloaded from http://R-Project.org
R - as a Statistical software
 It has very good computing performance
 R makes its view especially in colleges &
universities
 It has excellent built in help system
 Its graphical environment is flexible and
powerful
 Easy for new user
 Easy to extend with user written functions
 It provides scripting and interacting facilities
 Vectors as the basic data structure
Statistical features
 R is an interpreted language
 users typically access it through a command-line
interpreter
 Like other similar languages such as APL and
MATLAB, R supports matrix arithmetic
 R's data structures include vectors, matrices, arrays,
data frames (similar to tables in a relational
database) and lists.
 R supports procedural programming with functions
and, for some functions, object-oriented
programming with generic functions.
R-Preliminaries
Common operators:
 Arithmatic Operator
+ Addition
- Subtract
* Multiplication
/ Division
^ Exponential
 Relational Operator
< Lessthan
> Greaterthan
<= Lessthan Equal
>= Greaterthan Equal
== Is Equal to
!= Not Equal
 Logical Operator
! NOT
& AND
| OR
 Assignment Operator
<- Left assignment
-> Right assignment
Eg : x<-2 Assigns the value 2 to the object x
x^2->y Assigns the value x^2 to the object y
Commands will be lines, starting with a # mark.
To display the value of y, we type ‘print(y)’ or ‘y’
Functions
 function name is followed by a set of parentheses
containing one or more arguments.
Eg: plot(height,weight)
 the function name is ‘plot’ and the arguments are
‘height’ and weight.
 positional matching
Method of data input
 C function (concatenate)
Eg: > x <- c(1, 2, 3)
> y <- c(10, 20)
> c(x, y, 5) # R command
[1] 1 2 3 10 20 5
 Sequence function
seq (“sequence”), is used for equidistant series of
numbers.
Eg: > seq(4,9) # R command
[1] 4 5 6 7 8 9
 If you want a sequence in jumps of 2
Eg: > seq(4,10,2)
[1] 4 6 8 10
Sequence operator “:”
> 4:9 # R command
[1] 4 5 6 7 8 9
 Scan function
Used to provide small quantities of data.
variable=scan() # R command
Used for creating data object
Eg: wt=Scan(103,102,108);
[1] 103 102 108
 Rep function
rep (“replicate”), is used to generate repeated
values
y=rep(x,n) # R command
X<-c(rep(1,4),rep(2,2));
 Data frames
o provides the table of data in R
object=data.frame(list of variables); # R command
o Display the content of data frame with row no.
o Column headings can be modified after creation of
frame.
o Colnames(name of data frame)= c(list of column under
double quotes)
Eg:
n<-c(2, 3, 5)
s<-c("aa", "bb", "cc")
b<-c(TRUE, FALSE,TRUE)
df<-data.frame(n, s, b)
df
o/p
n s b
2 aa TRUE
3 bb FALSE
5 cc TRUE
 Matrix function
> x <- 1:12
> dim(x) <- c(3,4)
> x
[,1] [,2] [,3] [,4]
[1,] 1 4 7 10
[2,] 2 5 8 11
[3,] 3 6 9 12
o The dim assignment function sets or changes the dimension
attribute of x, causing R to treat the vector of 12 numbers as a
3 × 4 matrix
o storage is column-major; that is, the elements of the first
column are followed by those of the second, etc.
o Convenient function to provide matrix type data.
o Another function used to create a data frame.
Object=matrix(c(data values) nrow=m,byrow=T/F)
o The byrow=T switch causes the matrix to be filled in a row
wise fashion rather than column wise
 List function
It is sometimes useful to combine a collection of
objects into a larger composite object.This can be
done using lists.
Eg: > list1 <- c(5640,6180,6390,6805,7515)
list2 <- c(3910,3885,5160,5645,7335)
> mylist <- list(before=list1,after=list2)
>mylist
$before
[1] 5640 6180 6390 6515 6805 7515
$after
[1] 3910 3885 5160 5645 7335
 Class function
used to decide the class of the data object
Eg: > a1<-c(‘x’,’y’);
class(a1);
o/p: character
 Built in functions
length() no. of elements of data
max()the maximum element of data
min() the minimum element of data
sort() sorting in increasing magnitude
-sort() “ decreasing “ etc
Graphics in R
 2 types of graphics function
o High level function, which creates a new graph
o Low level function, which adds elements to an already
existing graph
High level ploting functions
plot() Scatter plot
hist() Histogram
boxplot() box & whisker
barplot() bar diagram
Arguments to plot function
Argument explanation
Main= Tittle
Xlab= Label of X axis
Ylab Label of Y axis
Xlim= Specific X limit
Ylim= “ Y limit
Type= type of ‘p’ for points
Pch= Style of points(bw 0&20)
Col= colour
Low level ploting functions
Lines() Draw lines
abline() Lines given by intercept and slopes
points() Points
text() Texts in the plot
legent() List of symbols
 > age<-c(5,10,15,20)
 > freq<-c(10,15,30,20)
>plot(age,freq,xlab=age,ylab=freq,pch=1,col="b
lue",main="age vs frequency")
Probability Distributions
Distribution Rname Additional Argument
Binomial binom size,probability
Poisson pois lamda
Geometric geom probability
Hyper geom hyper m,n,k
Normal norm mean,sd
Uniform unif min,max
Gamma gamma shape,scale
Chi-square chisq df,df2,nCp
F p df1,df2,nCp
 Binomial Distribution
> n<-10
> p<-.5
> pr<dbinom(x,n,p)# for pmf (pbinom for pdf)
Error: object 'pr' not found
> pr<-dbinom(x,n,p)
> pr
[1] 0.009765625 0.117187500 0.246093750 0.009765625
> pmf<-data.frame(x,pr)
> pmf
x pr
1 1 0.009765625
2 3 0.117187500
3 5 0.246093750
4 9 0.009765625
>
plot(x,pr,type="h",main="binomial",lwd=2,xlab="x",ylab="pr")
Conclusion
 R is a flexible programming language designed to facilitate
exploratory data analysis, classical statistical tests, and high-
level graphics.
 R is a full-fledged programming language, with a rich
complement of mathematical functions, matrix operations and
control structures.
 With its rich and ever-expanding library of packages, R is on the
leading edge of development in statistics, data analytics, and
data mining.
 R has proven itself a useful tool within the growing field of big
data and has been integrated into several commercial packages,
such as IBM SPSS and InfoSphere, as well as Mathematica.
References
 Introductory Statistics with R- Peter
Dalgaard(2nd edition)
 Statistical Computing with R- Eric Slud
 Quick-R : Creating Graphs
http://www.statmethods.net/graphs/
Shoot your queries….?
Thank you
Ad

More Related Content

What's hot (20)

1. Linear Algebra for Machine Learning: Linear Systems
1. Linear Algebra for Machine Learning: Linear Systems1. Linear Algebra for Machine Learning: Linear Systems
1. Linear Algebra for Machine Learning: Linear Systems
Ceni Babaoglu, PhD
 
C++ advanced PPT.pdf
C++ advanced PPT.pdfC++ advanced PPT.pdf
C++ advanced PPT.pdf
DinashMaliya3
 
Descriptive Statistics in R.pptx
Descriptive Statistics in R.pptxDescriptive Statistics in R.pptx
Descriptive Statistics in R.pptx
Ramakrishna Reddy Bijjam
 
Computer Graphics
Computer GraphicsComputer Graphics
Computer Graphics
Sneha Chopra
 
Data analysis with R
Data analysis with RData analysis with R
Data analysis with R
ShareThis
 
Cluster analysis
Cluster analysisCluster analysis
Cluster analysis
Hohai university
 
Logistic regression in Machine Learning
Logistic regression in Machine LearningLogistic regression in Machine Learning
Logistic regression in Machine Learning
Kuppusamy P
 
Python programming : Standard Input and Output
Python programming : Standard Input and OutputPython programming : Standard Input and Output
Python programming : Standard Input and Output
Emertxe Information Technologies Pvt Ltd
 
Introduction to data analysis using R
Introduction to data analysis using RIntroduction to data analysis using R
Introduction to data analysis using R
Victoria López
 
Bresenham's line drawing algorithm
Bresenham's line drawing algorithmBresenham's line drawing algorithm
Bresenham's line drawing algorithm
nehrurevathy
 
K means Clustering
K means ClusteringK means Clustering
K means Clustering
Edureka!
 
Graph Based Clustering
Graph Based ClusteringGraph Based Clustering
Graph Based Clustering
SSA KPI
 
Cluster Analysis
Cluster AnalysisCluster Analysis
Cluster Analysis
Kamal Acharya
 
Rbootcamp Day 1
Rbootcamp Day 1Rbootcamp Day 1
Rbootcamp Day 1
Olga Scrivner
 
COM2304: Intensity Transformation and Spatial Filtering – I (Intensity Transf...
COM2304: Intensity Transformation and Spatial Filtering – I (Intensity Transf...COM2304: Intensity Transformation and Spatial Filtering – I (Intensity Transf...
COM2304: Intensity Transformation and Spatial Filtering – I (Intensity Transf...
Hemantha Kulathilake
 
Linear regression
Linear regressionLinear regression
Linear regression
MartinHogg9
 
Introduction to c programming
Introduction to c programmingIntroduction to c programming
Introduction to c programming
Alpana Gupta
 
2D viewing & clipping
2D viewing & clipping2D viewing & clipping
2D viewing & clipping
MdAlAmin187
 
Basics of Computer graphics lab
Basics of Computer graphics labBasics of Computer graphics lab
Basics of Computer graphics lab
Priya Goyal
 
Mid point line Algorithm - Computer Graphics
Mid point line Algorithm - Computer GraphicsMid point line Algorithm - Computer Graphics
Mid point line Algorithm - Computer Graphics
Drishti Bhalla
 
1. Linear Algebra for Machine Learning: Linear Systems
1. Linear Algebra for Machine Learning: Linear Systems1. Linear Algebra for Machine Learning: Linear Systems
1. Linear Algebra for Machine Learning: Linear Systems
Ceni Babaoglu, PhD
 
C++ advanced PPT.pdf
C++ advanced PPT.pdfC++ advanced PPT.pdf
C++ advanced PPT.pdf
DinashMaliya3
 
Data analysis with R
Data analysis with RData analysis with R
Data analysis with R
ShareThis
 
Logistic regression in Machine Learning
Logistic regression in Machine LearningLogistic regression in Machine Learning
Logistic regression in Machine Learning
Kuppusamy P
 
Introduction to data analysis using R
Introduction to data analysis using RIntroduction to data analysis using R
Introduction to data analysis using R
Victoria López
 
Bresenham's line drawing algorithm
Bresenham's line drawing algorithmBresenham's line drawing algorithm
Bresenham's line drawing algorithm
nehrurevathy
 
K means Clustering
K means ClusteringK means Clustering
K means Clustering
Edureka!
 
Graph Based Clustering
Graph Based ClusteringGraph Based Clustering
Graph Based Clustering
SSA KPI
 
COM2304: Intensity Transformation and Spatial Filtering – I (Intensity Transf...
COM2304: Intensity Transformation and Spatial Filtering – I (Intensity Transf...COM2304: Intensity Transformation and Spatial Filtering – I (Intensity Transf...
COM2304: Intensity Transformation and Spatial Filtering – I (Intensity Transf...
Hemantha Kulathilake
 
Linear regression
Linear regressionLinear regression
Linear regression
MartinHogg9
 
Introduction to c programming
Introduction to c programmingIntroduction to c programming
Introduction to c programming
Alpana Gupta
 
2D viewing & clipping
2D viewing & clipping2D viewing & clipping
2D viewing & clipping
MdAlAmin187
 
Basics of Computer graphics lab
Basics of Computer graphics labBasics of Computer graphics lab
Basics of Computer graphics lab
Priya Goyal
 
Mid point line Algorithm - Computer Graphics
Mid point line Algorithm - Computer GraphicsMid point line Algorithm - Computer Graphics
Mid point line Algorithm - Computer Graphics
Drishti Bhalla
 

Viewers also liked (9)

statistical computation using R- report
statistical computation using R- reportstatistical computation using R- report
statistical computation using R- report
Kamarudheen KV
 
R seminar dplyr package
R seminar dplyr packageR seminar dplyr package
R seminar dplyr package
Muhammad Nabi Ahmad
 
Why R? A Brief Introduction to the Open Source Statistics Platform
Why R? A Brief Introduction to the Open Source Statistics PlatformWhy R? A Brief Introduction to the Open Source Statistics Platform
Why R? A Brief Introduction to the Open Source Statistics Platform
Syracuse University
 
Introduction to R Programming
Introduction to R ProgrammingIntroduction to R Programming
Introduction to R Programming
izahn
 
R language tutorial
R language tutorialR language tutorial
R language tutorial
David Chiu
 
Class ppt intro to r
Class ppt intro to rClass ppt intro to r
Class ppt intro to r
JigsawAcademy2014
 
R programming
R programmingR programming
R programming
Shantanu Patil
 
Introduction to data structures and Algorithm
Introduction to data structures and AlgorithmIntroduction to data structures and Algorithm
Introduction to data structures and Algorithm
Dhaval Kaneria
 
Back to the Future (evolving model of communication agencies and content in t...
Back to the Future (evolving model of communication agencies and content in t...Back to the Future (evolving model of communication agencies and content in t...
Back to the Future (evolving model of communication agencies and content in t...
Jimmy Ghazal
 
statistical computation using R- report
statistical computation using R- reportstatistical computation using R- report
statistical computation using R- report
Kamarudheen KV
 
Why R? A Brief Introduction to the Open Source Statistics Platform
Why R? A Brief Introduction to the Open Source Statistics PlatformWhy R? A Brief Introduction to the Open Source Statistics Platform
Why R? A Brief Introduction to the Open Source Statistics Platform
Syracuse University
 
Introduction to R Programming
Introduction to R ProgrammingIntroduction to R Programming
Introduction to R Programming
izahn
 
R language tutorial
R language tutorialR language tutorial
R language tutorial
David Chiu
 
Introduction to data structures and Algorithm
Introduction to data structures and AlgorithmIntroduction to data structures and Algorithm
Introduction to data structures and Algorithm
Dhaval Kaneria
 
Back to the Future (evolving model of communication agencies and content in t...
Back to the Future (evolving model of communication agencies and content in t...Back to the Future (evolving model of communication agencies and content in t...
Back to the Future (evolving model of communication agencies and content in t...
Jimmy Ghazal
 
Ad

Similar to statistical computation using R- an intro.. (20)

R Language Introduction
R Language IntroductionR Language Introduction
R Language Introduction
Khaled Al-Shamaa
 
Introduction to r
Introduction to rIntroduction to r
Introduction to r
Golden Julie Jesus
 
R Basics
R BasicsR Basics
R Basics
Dr.E.N.Sathishkumar
 
R tutorial for a windows environment
R tutorial for a windows environmentR tutorial for a windows environment
R tutorial for a windows environment
Yogendra Chaubey
 
R language introduction
R language introductionR language introduction
R language introduction
Shashwat Shriparv
 
Introduction to matlab
Introduction to matlabIntroduction to matlab
Introduction to matlab
Khulna University
 
R교육1
R교육1R교육1
R교육1
Kangwook Lee
 
R Programming Intro
R Programming IntroR Programming Intro
R Programming Intro
062MayankSinghal
 
Matlab1
Matlab1Matlab1
Matlab1
guest8ba004
 
Chart and graphs in R programming language
Chart and graphs in R programming language Chart and graphs in R programming language
Chart and graphs in R programming language
CHANDAN KUMAR
 
Big Data Mining in Indian Economic Survey 2017
Big Data Mining in Indian Economic Survey 2017Big Data Mining in Indian Economic Survey 2017
Big Data Mining in Indian Economic Survey 2017
Parth Khare
 
A brief introduction to apply functions
A brief introduction to apply functionsA brief introduction to apply functions
A brief introduction to apply functions
NIKET CHAURASIA
 
R programming intro with examples
R programming intro with examplesR programming intro with examples
R programming intro with examples
Dennis
 
Introduction to matlab lecture 4 of 4
Introduction to matlab lecture 4 of 4Introduction to matlab lecture 4 of 4
Introduction to matlab lecture 4 of 4
Randa Elanwar
 
R for Statistical Computing
R for Statistical ComputingR for Statistical Computing
R for Statistical Computing
Mohammed El Rafie Tarabay
 
Loops and functions in r
Loops and functions in rLoops and functions in r
Loops and functions in r
manikanta361
 
Programming in R
Programming in RProgramming in R
Programming in R
Smruti Sarangi
 
R basics
R basicsR basics
R basics
Sagun Baijal
 
Basic Analysis using Python
Basic Analysis using PythonBasic Analysis using Python
Basic Analysis using Python
Sankhya_Analytics
 
R Cheat Sheet for Data Analysts and Statisticians.pdf
R Cheat Sheet for Data Analysts and Statisticians.pdfR Cheat Sheet for Data Analysts and Statisticians.pdf
R Cheat Sheet for Data Analysts and Statisticians.pdf
Timothy McBush Hiele
 
R tutorial for a windows environment
R tutorial for a windows environmentR tutorial for a windows environment
R tutorial for a windows environment
Yogendra Chaubey
 
Chart and graphs in R programming language
Chart and graphs in R programming language Chart and graphs in R programming language
Chart and graphs in R programming language
CHANDAN KUMAR
 
Big Data Mining in Indian Economic Survey 2017
Big Data Mining in Indian Economic Survey 2017Big Data Mining in Indian Economic Survey 2017
Big Data Mining in Indian Economic Survey 2017
Parth Khare
 
A brief introduction to apply functions
A brief introduction to apply functionsA brief introduction to apply functions
A brief introduction to apply functions
NIKET CHAURASIA
 
R programming intro with examples
R programming intro with examplesR programming intro with examples
R programming intro with examples
Dennis
 
Introduction to matlab lecture 4 of 4
Introduction to matlab lecture 4 of 4Introduction to matlab lecture 4 of 4
Introduction to matlab lecture 4 of 4
Randa Elanwar
 
Loops and functions in r
Loops and functions in rLoops and functions in r
Loops and functions in r
manikanta361
 
R Cheat Sheet for Data Analysts and Statisticians.pdf
R Cheat Sheet for Data Analysts and Statisticians.pdfR Cheat Sheet for Data Analysts and Statisticians.pdf
R Cheat Sheet for Data Analysts and Statisticians.pdf
Timothy McBush Hiele
 
Ad

Recently uploaded (20)

Build 3D Animated Safety Induction - Tech EHS
Build 3D Animated Safety Induction - Tech EHSBuild 3D Animated Safety Induction - Tech EHS
Build 3D Animated Safety Induction - Tech EHS
TECH EHS Solution
 
Big Data Analytics Quick Research Guide by Arthur Morgan
Big Data Analytics Quick Research Guide by Arthur MorganBig Data Analytics Quick Research Guide by Arthur Morgan
Big Data Analytics Quick Research Guide by Arthur Morgan
Arthur Morgan
 
Heap, Types of Heap, Insertion and Deletion
Heap, Types of Heap, Insertion and DeletionHeap, Types of Heap, Insertion and Deletion
Heap, Types of Heap, Insertion and Deletion
Jaydeep Kale
 
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc
 
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdfSAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
Precisely
 
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul
 
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager APIUiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPathCommunity
 
Are Cloud PBX Providers in India Reliable for Small Businesses (1).pdf
Are Cloud PBX Providers in India Reliable for Small Businesses (1).pdfAre Cloud PBX Providers in India Reliable for Small Businesses (1).pdf
Are Cloud PBX Providers in India Reliable for Small Businesses (1).pdf
Telecoms Supermarket
 
ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes Partner Innovation Updates for May 2025ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes
 
Build Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For DevsBuild Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For Devs
Brian McKeiver
 
Top 10 IT Help Desk Outsourcing Services
Top 10 IT Help Desk Outsourcing ServicesTop 10 IT Help Desk Outsourcing Services
Top 10 IT Help Desk Outsourcing Services
Infrassist Technologies Pvt. Ltd.
 
Quantum Computing Quick Research Guide by Arthur Morgan
Quantum Computing Quick Research Guide by Arthur MorganQuantum Computing Quick Research Guide by Arthur Morgan
Quantum Computing Quick Research Guide by Arthur Morgan
Arthur Morgan
 
Cybersecurity Identity and Access Solutions using Azure AD
Cybersecurity Identity and Access Solutions using Azure ADCybersecurity Identity and Access Solutions using Azure AD
Cybersecurity Identity and Access Solutions using Azure AD
VICTOR MAESTRE RAMIREZ
 
TrsLabs Consultants - DeFi, WEb3, Token Listing
TrsLabs Consultants - DeFi, WEb3, Token ListingTrsLabs Consultants - DeFi, WEb3, Token Listing
TrsLabs Consultants - DeFi, WEb3, Token Listing
Trs Labs
 
Social Media App Development Company-EmizenTech
Social Media App Development Company-EmizenTechSocial Media App Development Company-EmizenTech
Social Media App Development Company-EmizenTech
Steve Jonas
 
Dev Dives: Automate and orchestrate your processes with UiPath Maestro
Dev Dives: Automate and orchestrate your processes with UiPath MaestroDev Dives: Automate and orchestrate your processes with UiPath Maestro
Dev Dives: Automate and orchestrate your processes with UiPath Maestro
UiPathCommunity
 
Unlocking the Power of IVR: A Comprehensive Guide
Unlocking the Power of IVR: A Comprehensive GuideUnlocking the Power of IVR: A Comprehensive Guide
Unlocking the Power of IVR: A Comprehensive Guide
vikasascentbpo
 
TrsLabs - Fintech Product & Business Consulting
TrsLabs - Fintech Product & Business ConsultingTrsLabs - Fintech Product & Business Consulting
TrsLabs - Fintech Product & Business Consulting
Trs Labs
 
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptxIncreasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Anoop Ashok
 
How analogue intelligence complements AI
How analogue intelligence complements AIHow analogue intelligence complements AI
How analogue intelligence complements AI
Paul Rowe
 
Build 3D Animated Safety Induction - Tech EHS
Build 3D Animated Safety Induction - Tech EHSBuild 3D Animated Safety Induction - Tech EHS
Build 3D Animated Safety Induction - Tech EHS
TECH EHS Solution
 
Big Data Analytics Quick Research Guide by Arthur Morgan
Big Data Analytics Quick Research Guide by Arthur MorganBig Data Analytics Quick Research Guide by Arthur Morgan
Big Data Analytics Quick Research Guide by Arthur Morgan
Arthur Morgan
 
Heap, Types of Heap, Insertion and Deletion
Heap, Types of Heap, Insertion and DeletionHeap, Types of Heap, Insertion and Deletion
Heap, Types of Heap, Insertion and Deletion
Jaydeep Kale
 
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc
 
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdfSAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
Precisely
 
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul
 
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager APIUiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPathCommunity
 
Are Cloud PBX Providers in India Reliable for Small Businesses (1).pdf
Are Cloud PBX Providers in India Reliable for Small Businesses (1).pdfAre Cloud PBX Providers in India Reliable for Small Businesses (1).pdf
Are Cloud PBX Providers in India Reliable for Small Businesses (1).pdf
Telecoms Supermarket
 
ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes Partner Innovation Updates for May 2025ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes
 
Build Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For DevsBuild Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For Devs
Brian McKeiver
 
Quantum Computing Quick Research Guide by Arthur Morgan
Quantum Computing Quick Research Guide by Arthur MorganQuantum Computing Quick Research Guide by Arthur Morgan
Quantum Computing Quick Research Guide by Arthur Morgan
Arthur Morgan
 
Cybersecurity Identity and Access Solutions using Azure AD
Cybersecurity Identity and Access Solutions using Azure ADCybersecurity Identity and Access Solutions using Azure AD
Cybersecurity Identity and Access Solutions using Azure AD
VICTOR MAESTRE RAMIREZ
 
TrsLabs Consultants - DeFi, WEb3, Token Listing
TrsLabs Consultants - DeFi, WEb3, Token ListingTrsLabs Consultants - DeFi, WEb3, Token Listing
TrsLabs Consultants - DeFi, WEb3, Token Listing
Trs Labs
 
Social Media App Development Company-EmizenTech
Social Media App Development Company-EmizenTechSocial Media App Development Company-EmizenTech
Social Media App Development Company-EmizenTech
Steve Jonas
 
Dev Dives: Automate and orchestrate your processes with UiPath Maestro
Dev Dives: Automate and orchestrate your processes with UiPath MaestroDev Dives: Automate and orchestrate your processes with UiPath Maestro
Dev Dives: Automate and orchestrate your processes with UiPath Maestro
UiPathCommunity
 
Unlocking the Power of IVR: A Comprehensive Guide
Unlocking the Power of IVR: A Comprehensive GuideUnlocking the Power of IVR: A Comprehensive Guide
Unlocking the Power of IVR: A Comprehensive Guide
vikasascentbpo
 
TrsLabs - Fintech Product & Business Consulting
TrsLabs - Fintech Product & Business ConsultingTrsLabs - Fintech Product & Business Consulting
TrsLabs - Fintech Product & Business Consulting
Trs Labs
 
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptxIncreasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Anoop Ashok
 
How analogue intelligence complements AI
How analogue intelligence complements AIHow analogue intelligence complements AI
How analogue intelligence complements AI
Paul Rowe
 

statistical computation using R- an intro..

  • 2.  Introduction  R as a statistical software  Statistical features  R preliminaries  Functions in R  Graphics in R  Distributions  Conclusion  References
  • 3. Introduction  programming language and software environment for statistical computing and graphics.  S,S PLUS.  Developed by Ross Ihaka and Robert Gentleman at the University of Auckland, New Zealand.  Open source software  R works fundamentally by the question-and-answer model  Can be downloaded from http://R-Project.org
  • 4. R - as a Statistical software  It has very good computing performance  R makes its view especially in colleges & universities  It has excellent built in help system  Its graphical environment is flexible and powerful  Easy for new user  Easy to extend with user written functions  It provides scripting and interacting facilities  Vectors as the basic data structure
  • 5. Statistical features  R is an interpreted language  users typically access it through a command-line interpreter  Like other similar languages such as APL and MATLAB, R supports matrix arithmetic  R's data structures include vectors, matrices, arrays, data frames (similar to tables in a relational database) and lists.  R supports procedural programming with functions and, for some functions, object-oriented programming with generic functions.
  • 6. R-Preliminaries Common operators:  Arithmatic Operator + Addition - Subtract * Multiplication / Division ^ Exponential  Relational Operator < Lessthan > Greaterthan <= Lessthan Equal >= Greaterthan Equal == Is Equal to != Not Equal
  • 7.  Logical Operator ! NOT & AND | OR  Assignment Operator <- Left assignment -> Right assignment Eg : x<-2 Assigns the value 2 to the object x x^2->y Assigns the value x^2 to the object y Commands will be lines, starting with a # mark. To display the value of y, we type ‘print(y)’ or ‘y’
  • 8. Functions  function name is followed by a set of parentheses containing one or more arguments. Eg: plot(height,weight)  the function name is ‘plot’ and the arguments are ‘height’ and weight.  positional matching
  • 9. Method of data input  C function (concatenate) Eg: > x <- c(1, 2, 3) > y <- c(10, 20) > c(x, y, 5) # R command [1] 1 2 3 10 20 5  Sequence function seq (“sequence”), is used for equidistant series of numbers. Eg: > seq(4,9) # R command [1] 4 5 6 7 8 9
  • 10.  If you want a sequence in jumps of 2 Eg: > seq(4,10,2) [1] 4 6 8 10 Sequence operator “:” > 4:9 # R command [1] 4 5 6 7 8 9  Scan function Used to provide small quantities of data. variable=scan() # R command Used for creating data object Eg: wt=Scan(103,102,108); [1] 103 102 108
  • 11.  Rep function rep (“replicate”), is used to generate repeated values y=rep(x,n) # R command X<-c(rep(1,4),rep(2,2));  Data frames o provides the table of data in R object=data.frame(list of variables); # R command o Display the content of data frame with row no. o Column headings can be modified after creation of frame. o Colnames(name of data frame)= c(list of column under double quotes)
  • 12. Eg: n<-c(2, 3, 5) s<-c("aa", "bb", "cc") b<-c(TRUE, FALSE,TRUE) df<-data.frame(n, s, b) df o/p n s b 2 aa TRUE 3 bb FALSE 5 cc TRUE
  • 13.  Matrix function > x <- 1:12 > dim(x) <- c(3,4) > x [,1] [,2] [,3] [,4] [1,] 1 4 7 10 [2,] 2 5 8 11 [3,] 3 6 9 12 o The dim assignment function sets or changes the dimension attribute of x, causing R to treat the vector of 12 numbers as a 3 × 4 matrix o storage is column-major; that is, the elements of the first column are followed by those of the second, etc. o Convenient function to provide matrix type data. o Another function used to create a data frame. Object=matrix(c(data values) nrow=m,byrow=T/F) o The byrow=T switch causes the matrix to be filled in a row wise fashion rather than column wise
  • 14.  List function It is sometimes useful to combine a collection of objects into a larger composite object.This can be done using lists. Eg: > list1 <- c(5640,6180,6390,6805,7515) list2 <- c(3910,3885,5160,5645,7335) > mylist <- list(before=list1,after=list2) >mylist $before [1] 5640 6180 6390 6515 6805 7515 $after [1] 3910 3885 5160 5645 7335
  • 15.  Class function used to decide the class of the data object Eg: > a1<-c(‘x’,’y’); class(a1); o/p: character  Built in functions length() no. of elements of data max()the maximum element of data min() the minimum element of data sort() sorting in increasing magnitude -sort() “ decreasing “ etc
  • 16. Graphics in R  2 types of graphics function o High level function, which creates a new graph o Low level function, which adds elements to an already existing graph High level ploting functions plot() Scatter plot hist() Histogram boxplot() box & whisker barplot() bar diagram
  • 17. Arguments to plot function Argument explanation Main= Tittle Xlab= Label of X axis Ylab Label of Y axis Xlim= Specific X limit Ylim= “ Y limit Type= type of ‘p’ for points Pch= Style of points(bw 0&20) Col= colour
  • 18. Low level ploting functions Lines() Draw lines abline() Lines given by intercept and slopes points() Points text() Texts in the plot legent() List of symbols
  • 19.  > age<-c(5,10,15,20)  > freq<-c(10,15,30,20) >plot(age,freq,xlab=age,ylab=freq,pch=1,col="b lue",main="age vs frequency")
  • 20. Probability Distributions Distribution Rname Additional Argument Binomial binom size,probability Poisson pois lamda Geometric geom probability Hyper geom hyper m,n,k Normal norm mean,sd Uniform unif min,max Gamma gamma shape,scale Chi-square chisq df,df2,nCp F p df1,df2,nCp
  • 21.  Binomial Distribution > n<-10 > p<-.5 > pr<dbinom(x,n,p)# for pmf (pbinom for pdf) Error: object 'pr' not found > pr<-dbinom(x,n,p) > pr [1] 0.009765625 0.117187500 0.246093750 0.009765625 > pmf<-data.frame(x,pr) > pmf x pr 1 1 0.009765625 2 3 0.117187500 3 5 0.246093750 4 9 0.009765625 > plot(x,pr,type="h",main="binomial",lwd=2,xlab="x",ylab="pr")
  • 22. Conclusion  R is a flexible programming language designed to facilitate exploratory data analysis, classical statistical tests, and high- level graphics.  R is a full-fledged programming language, with a rich complement of mathematical functions, matrix operations and control structures.  With its rich and ever-expanding library of packages, R is on the leading edge of development in statistics, data analytics, and data mining.  R has proven itself a useful tool within the growing field of big data and has been integrated into several commercial packages, such as IBM SPSS and InfoSphere, as well as Mathematica.
  • 23. References  Introductory Statistics with R- Peter Dalgaard(2nd edition)  Statistical Computing with R- Eric Slud  Quick-R : Creating Graphs http://www.statmethods.net/graphs/