mail@pastecode.io avatar
2 years ago
1.5 kB
rep(x,n) // For repititon x n times

sample(x,n) // Sample n items from x array

pbinom(x,size,prob) // Get cumuluative probability distribution

dbinom(x,size,prob) // Get pdf

pnorm(x,mu,sigma) // Get cdf given mu , sigma

dnorm(x,mu,sigma) // Get pdf given mu, sigma

dpois(x,lambda) // Get pdf for poisson distribution

dhyper(x,m,n,k) // Get pdf for hypernomial distribution , m = defective , n = Non defective


punif(x,lower,upper,lower.tail) // Calculate cdf for unifiorm distribution

dexp(x,lambda) // pdf for exponential distribution

pexp(x,lambda) // cdf for exponential distribution

rexp(n,lambda) // generate exponential distribution for n numbers

dgamma(x,shape,scale) // pdf for gamma distribution , shape = alpha, scale = beta

pgamma(x,shape,scale) // cdf for gamma distribution

qgamma(x,shape,scale) // gives gamma quantile function

rt(n,df) // used to create a random sequence of values from Student t-distribution

rchisq(n,df) // Used to generate a random chi square distribution 

dt(x,df) // Returns the value of the probability density function (pdf) of the Student t distribution given a certain random variable x and degrees of freedom df.

qf(x,df1,df2) // Gets quantile function of f- distribution

pf(x,df1,df2) //  Gets cdf of f-distribution

rf(n,df1,df2) // Generates random n numbers from f-distribution

abline(h=,v=,col=) // Draws a straight line in r plot ,where h y-value specifies horizontal line ,v specifies x-value for vertical line