Professional Documents
Culture Documents
Probability Distributions
Function Function Values What does it do?
Where x is the value of interest, n = sample size, and p This is the probability mass function. Finds P(X=x) for
dbinom(x,n,p)
is the probability of success binomial distribution
This is the cumulative distribution function. Finds P(X<=x) for
pbinom(x,n,p) "
binomial distribution
Where x is the value of interest, average lambda is the This is the probability mass function. Finds P(X=x) for poisson
dpois(x,lambda)
rate of success per unit distribution
This is the cumulative distribution function. Finds P(X<=x) for
ppois(x,lambda) "
poisson distribution
Where x is the value of interest, a is the lower bound This is the cumulative density function. Finds P(X≤x) for
punif(x,a,b)
and b is the upper bound of the uniform dist. Uniform distribution.
This is the inverse of cumulative density function. Finds
Where p is percentage that falls below x, a is the lower
qunif(p,a,b) percentiles for Uniform distribution. That is, x_p for
bound and b is the upper bound of the uniform dist.
expression P(X≤x_p )=p
Where x is the value of interest, shape = α and rate = Cumulative density function, finds P(X≤x) for gamma
pgamma(x,shape, rate)
1/β distribution
Where p is percentage that falls below x, shape = α
qgamma(p,shape, rate) Inverse of cumulative density function.
and rate = 1/β
Where x is the value of interest, λ is the rate Cumulative density function, finds P(X≤x) for exponential
pexp(x,lambda)
parameter distribution
Where p is percentage that falls below x, λ is the rate
qexp(p,lambda) Inverse of cumulative density function.
parameter
Where x is the value of interest, mu is the mean and Cumulative density function, finds P(X≤x) for norm
pnorm(x,mu, sigma)
sigma the standard deviation distribution
Where p is percentage that falls below x, mu is the Inverse of cumulative density function. Finds percentiles for
qnorm(p,mu, sigma)
mean and sigma the standard deviation norm distribution. That is, x_p for expression P(X≤x_p )=p
Entering Data
Function Function Values What does it do?
c(x_1,x_2,…,x_n) Where x_1 to x_n are variable values. Makes a vector of values x_1 to x_n.
data.frame(v1,v2,v3…) v1, v2… etc are vector names. Combine vectors into a data frame.
Where filename.csv is either the data set name or file
read.csv(filename.csv, path. header = TRUE, means the first row is variable
Loads .csv data set in R.
header = TRUE) names. Can use command file.choose() for search
window.
Basic Visualization and Summary
commands
Function Function Values What does it do?
Where v is the quantitative variable of interest. Can
hist(v) Creates histogram for quantitative variable.
obtain from a data set with datasetname$v.
stem(v) "" Creates stemplot for quantitative variable.
mean(v) "" Calculates average for quantitative variable.
median(v) "" Calculates median for quantitative variable.
sd(v) "" Calculates the sample standard deviation.
summary(v) "" Calculates values of the five number summary and mean.
boxplot(v) "" Creates boxplot for quantitative variable.
Where v is the quantitative variable of interest and p is
quantile(v, p/100) the desired percentile. Can find quartiles with p = 0.25 Calculates the percentile value.
and p = 0.75.