Upcoming SlideShare
×

Distributions in R

554 views
437 views

Published on

Published in: Technology, Education
1 Like
Statistics
Notes
• Full Name
Comment goes here.

Are you sure you want to Yes No
• Be the first to comment

Views
Total views
554
On SlideShare
0
From Embeds
0
Number of Embeds
12
Actions
Shares
0
0
0
Likes
1
Embeds 0
No embeds

No notes for slide

Distributions in R

1. 1. Distributions in R Codes are in Blue. For Feedback Mail me: sharmakarishma91@gmail.com
2. 2. Discrete and Continuous Distributions • Random Variable: It is a numerical description of the outcome of an experiment. • What is Experiment: A process that generates well defined outcomes. • Discrete Random Variable: A random Variable that may assume either a finite no of values or an infinite sequence of values is referred to as a discrete random variable. For Feedback Mail me: sharmakarishma91@gmail.com
3. 3. For Feedback Mail me: sharmakarishma91@gmail.com Contd.. • Example:
4. 4. Contd.. • Continuous Random Variables A Random variable that may assume any numerical value in an interval or collection of intervals is called a continuous random variable. Experimental outcomes based on measurement scales such as time, weight, distance and temperature can be described by continuous random variables. For Feedback Mail me: sharmakarishma91@gmail.com
5. 5. Binomial probability function Binomial probability function F(x) is • n = number of trials • k = number of successes • n – k = number of failures • p = probability of success in one trial • q = 1 – p = probability of failure in one trial For Feedback Mail me: sharmakarishma91@gmail.com
6. 6. Poisson Probability Distribution A discrete random variable that is often useful in estimating the number of occurrences over a specified interval of time or space. For example: the random variable of interest might be the no of arrivals at a car wash in one hour or the no of leaks in 100 miles of pipeline. For Feedback Mail me: sharmakarishma91@gmail.com
7. 7. Contd.. For Feedback Mail me: sharmakarishma91@gmail.com
8. 8. Geometric distribution If the probability of success is 0.35, what is the probability that the first success will be on the 5th trial? dgeom (4 ,0.35) [1] 0.06247719 dgeom gives the density (or probability mass function for discrete variables), pgeom gives the distribution function and rgeom generates random deviates. This is true for the functions used for Binomial, Poisson and Normal calculations as well. For Feedback Mail me: sharmakarishma91@gmail.com
9. 9. Binomial distribution If the probability of success is 0.35, what is the probability of 3 successes in 5 trials? dbinom (3 ,5 ,0.35) [1] 0.1811469 at least 3 successes in 5 trials? sum( dbinom (3:5 ,5 ,0.35) ) [1] 0.2351694 For Feedback Mail me: sharmakarishma91@gmail.com
10. 10. Poisson distribution The number of track accidents per week in a small city has Poisson distribution with mean equal to 3. What is the probability of two accidents in a week? dpois (2 ,3) [1] 0.2240418 at most one accident in a week? sum( dpois (0:1 ,3) ) [1] 0.1991483 For Feedback Mail me: sharmakarishma91@gmail.com
11. 11. Normal distribution Scores on an exam are distributed normally with a mean of 65 and a standard deviation of 12. What percentage of the students have scores • below 50 pnorm (50 ,65 ,12) [1] 0.1056498 • between 50 and 70? pnorm (70 ,65 ,12) -pnorm (50 ,65 ,12) [1] 0.5558891 What is the 90th percentile of the score distribution? qnorm (.90 ,65 ,12) [1] 80.37862 For Feedback Mail me: sharmakarishma91@gmail.com
12. 12. THANK YOU. Reference: http://cran.r-project.org/ For Feedback Mail me: sharmakarishma91@gmail.com