SlideShare una empresa de Scribd logo
1 de 25
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

Más contenido relacionado

La actualidad más candente

DIGITAL IMAGE PROCESSING - LECTURE NOTES
DIGITAL IMAGE PROCESSING - LECTURE NOTESDIGITAL IMAGE PROCESSING - LECTURE NOTES
DIGITAL IMAGE PROCESSING - LECTURE NOTESEzhilya venkat
 
DisMath-lecture-1-Introduction-to-Discrete-Maths-08032022-114934am.pptx
DisMath-lecture-1-Introduction-to-Discrete-Maths-08032022-114934am.pptxDisMath-lecture-1-Introduction-to-Discrete-Maths-08032022-114934am.pptx
DisMath-lecture-1-Introduction-to-Discrete-Maths-08032022-114934am.pptxAdeel Saifee
 
Unit 3
Unit 3Unit 3
Unit 3ypnrao
 
CHAPTER 6 REQUIREMENTS MODELING: SCENARIO based Model , Class based moddel
CHAPTER 6 REQUIREMENTS MODELING: SCENARIO based Model , Class based moddelCHAPTER 6 REQUIREMENTS MODELING: SCENARIO based Model , Class based moddel
CHAPTER 6 REQUIREMENTS MODELING: SCENARIO based Model , Class based moddelmohamed khalaf alla mohamedain
 
Image enhancement techniques a review
Image enhancement techniques   a reviewImage enhancement techniques   a review
Image enhancement techniques a revieweSAT Journals
 
Bayesian Networks - A Brief Introduction
Bayesian Networks - A Brief IntroductionBayesian Networks - A Brief Introduction
Bayesian Networks - A Brief IntroductionAdnan Masood
 
Digitized images and
Digitized images andDigitized images and
Digitized images andAshish Kumar
 
1.1. the central concepts of automata theory
1.1. the central concepts of automata theory1.1. the central concepts of automata theory
1.1. the central concepts of automata theorySampath Kumar S
 
Linear regression
Linear regressionLinear regression
Linear regressionMartinHogg9
 
Elliptic Curve Cryptography: Arithmetic behind
Elliptic Curve Cryptography: Arithmetic behindElliptic Curve Cryptography: Arithmetic behind
Elliptic Curve Cryptography: Arithmetic behindAyan Sengupta
 
R language tutorial
R language tutorialR language tutorial
R language tutorialDavid Chiu
 
applications of computer graphics
applications of computer graphicsapplications of computer graphics
applications of computer graphicsAaina Katyal
 

La actualidad más candente (20)

Graph Theory: Trees
Graph Theory: TreesGraph Theory: Trees
Graph Theory: Trees
 
R studio
R studio R studio
R studio
 
DIGITAL IMAGE PROCESSING - LECTURE NOTES
DIGITAL IMAGE PROCESSING - LECTURE NOTESDIGITAL IMAGE PROCESSING - LECTURE NOTES
DIGITAL IMAGE PROCESSING - LECTURE NOTES
 
DisMath-lecture-1-Introduction-to-Discrete-Maths-08032022-114934am.pptx
DisMath-lecture-1-Introduction-to-Discrete-Maths-08032022-114934am.pptxDisMath-lecture-1-Introduction-to-Discrete-Maths-08032022-114934am.pptx
DisMath-lecture-1-Introduction-to-Discrete-Maths-08032022-114934am.pptx
 
Unit 3
Unit 3Unit 3
Unit 3
 
CHAPTER 6 REQUIREMENTS MODELING: SCENARIO based Model , Class based moddel
CHAPTER 6 REQUIREMENTS MODELING: SCENARIO based Model , Class based moddelCHAPTER 6 REQUIREMENTS MODELING: SCENARIO based Model , Class based moddel
CHAPTER 6 REQUIREMENTS MODELING: SCENARIO based Model , Class based moddel
 
Image enhancement techniques a review
Image enhancement techniques   a reviewImage enhancement techniques   a review
Image enhancement techniques a review
 
Software design
Software designSoftware design
Software design
 
Bayesian Networks - A Brief Introduction
Bayesian Networks - A Brief IntroductionBayesian Networks - A Brief Introduction
Bayesian Networks - A Brief Introduction
 
Primality
PrimalityPrimality
Primality
 
Pixel relationships
Pixel relationshipsPixel relationships
Pixel relationships
 
Digitized images and
Digitized images andDigitized images and
Digitized images and
 
1.1. the central concepts of automata theory
1.1. the central concepts of automata theory1.1. the central concepts of automata theory
1.1. the central concepts of automata theory
 
Rough K Means - Numerical Example
Rough K Means - Numerical ExampleRough K Means - Numerical Example
Rough K Means - Numerical Example
 
Linear regression
Linear regressionLinear regression
Linear regression
 
Elliptic Curve Cryptography: Arithmetic behind
Elliptic Curve Cryptography: Arithmetic behindElliptic Curve Cryptography: Arithmetic behind
Elliptic Curve Cryptography: Arithmetic behind
 
Logistic regression
Logistic regressionLogistic regression
Logistic regression
 
Evolution of MATLAB
Evolution of MATLABEvolution of MATLAB
Evolution of MATLAB
 
R language tutorial
R language tutorialR language tutorial
R language tutorial
 
applications of computer graphics
applications of computer graphicsapplications of computer graphics
applications of computer graphics
 

Destacado

statistical computation using R- report
statistical computation using R- reportstatistical computation using R- report
statistical computation using R- reportKamarudheen 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 PlatformSyracuse University
 
Introduction to data structures and Algorithm
Introduction to data structures and AlgorithmIntroduction to data structures and Algorithm
Introduction to data structures and AlgorithmDhaval 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
 

Destacado (7)

statistical computation using R- report
statistical computation using R- reportstatistical computation using R- report
statistical computation using R- report
 
R seminar dplyr package
R seminar dplyr packageR seminar dplyr package
R seminar dplyr package
 
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
 
Class ppt intro to r
Class ppt intro to rClass ppt intro to r
Class ppt intro to r
 
R programming
R programmingR programming
R programming
 
Introduction to data structures and Algorithm
Introduction to data structures and AlgorithmIntroduction to data structures and Algorithm
Introduction to data structures and Algorithm
 
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...
 

Similar a statistical computation using R- an intro..

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

R Language Introduction
R Language IntroductionR Language Introduction
R Language Introduction
 
Introduction to r
Introduction to rIntroduction to r
Introduction to r
 
R Basics
R BasicsR Basics
R Basics
 
R tutorial for a windows environment
R tutorial for a windows environmentR tutorial for a windows environment
R tutorial for a windows environment
 
R language introduction
R language introductionR language introduction
R language introduction
 
Introduction to matlab
Introduction to matlabIntroduction to matlab
Introduction to matlab
 
R교육1
R교육1R교육1
R교육1
 
R Programming Intro
R Programming IntroR Programming Intro
R Programming Intro
 
Matlab1
Matlab1Matlab1
Matlab1
 
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
 
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
 
A brief introduction to apply functions
A brief introduction to apply functionsA brief introduction to apply functions
A brief introduction to apply functions
 
R programming intro with examples
R programming intro with examplesR programming intro with examples
R programming intro with examples
 
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
 
R for Statistical Computing
R for Statistical ComputingR for Statistical Computing
R for Statistical Computing
 
Loops and functions in r
Loops and functions in rLoops and functions in r
Loops and functions in r
 
Programming in R
Programming in RProgramming in R
Programming in R
 
R basics
R basicsR basics
R basics
 
Basic Analysis using Python
Basic Analysis using PythonBasic Analysis using Python
Basic Analysis using Python
 
An Intoduction to R
An Intoduction to RAn Intoduction to R
An Intoduction to R
 

Último

Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersRaghuram Pandurangan
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESmohitsingh558521
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfPrecisely
 

Último (20)

Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information Developers
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
 

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/