#Biostatistics 050 # PERMUTATIONS AND COMBINATIONS n=20 k=7 #PERMUTATIONS # No built-in function found, so I'll calculate it directly Permutations=factorial(n)/(factorial(n-k)) Permutations # COMBINATIONS - calculated directly Combinations=factorial(n)/(factorial(k)*factorial(n-k)) Combinations # BUILT-IN FUNCTION FOR COMBINATIONS choose(n,k) #VARIANCE AND COVARIANCE FUNCTIONS: attach(iris) SL=Sepal.Length SW=Sepal.Width PL=Petal.Length PW=Petal.Width detach(iris) IR=cbind(SL,SW,PL,PW) var(IR) cov(IR) var(iris) cov(iris)