Saturday, October 27, 2007

Statistical & Mathematical functions

### Statistical Functions

r : random
d: density
p: cumulative probability
q: quantity

binom(size,prob)
multinom(c(x1,x2,...,xr),n,c(p1,p2,...,pr))
geom(prob)
hyper(m,n,k)
pois(lambda)
unif(min,max)
norm(mean,sd)
mvnorm(mean, vector,covariance matrix) // multivariate
t(df)
chisq(df)
f(df1,df2)
exp(rate(=1/mean))
gamma(shape,rate)
beta(shape1,shape2)
cauchy(location, scale)
lnorm(mean,sd(of log))
logis(location,scale)
weibull(shape)
wilcox(m,n)

ex1) pnorm(1.) // Pr(Z < 1.0)
ex2) rt(5,7) // generating 5 random numbers from t distribution with df=7
ex3) dpois(1,3) // Pr(X = 1) = dpois(1, 3)
ex4) qnorm(0.975) // z which satisfies Pr(Z < z) = 0.975

### Mathematical Functionssqrt, abs
sin, cos, tan
asin, acos, atan
sinh, cosh, tanh
asinh, ashinh, achoh, atanh
exp, log, log10

### Beta and Gamma Functionsgamma(x)
lgamma(x)
psigamma(x, deriv=0)
digamma(x)
trigamma(x)
beta(a,b)
lbeta(a,b)
choose(n,k)
lchoose(n,k)
factorial(x)
lfactorial(x)


### numerical functions
Comparison Operator; <, >, ==, !, <=, >=, !=
Logic Operator; &, , xor, &&,
+, -, *, /, ^, %/% ; integer divide, %% ; Modulo function)

No comments: