Upload
cindy-lamusu
View
216
Download
0
Embed Size (px)
Citation preview
8/9/2019 Ch7 Binomial Expansions
1/9
http://www.yorku.ca/nuri/econ3500/ch7-binomial-combinations-pg215.219.pd
"rele#ant te$t pages%
Ch7
install.packages("combinat")library(combinat)
install.packages("gtools")
library(gtools)
install.packages("prob")
library(prob)
library(combinat)
library(gtools)library(prob)
# combinations {gtools}
combinations(3,2,letters[1:3])
combinations(3,2,letters[1:3],repeats=TRUE)
permutations(3,2,letters[1:3])
permutations(3,2,letters[1:3],repeats=TRUE)
permutationspermutations(3,2,repeats=TRUE)
permutations(3,2)
permutations(3,2,:!)
"=:!
permutations(3,2,")
combinations
combinations(3,2)combinations(3,2,1:3)
combinations(3,2,1:3,repeats=TRUE)
7.3 combinations an$ permutations
% urnsamples(", si&e = ', replace = ', or$ere$ = ')
% " a ector or $ata rame rom *hich samplin+ shoul$ tae place-
http://www.yorku.ca/nuri/econ3500/ch7-binomial-combinations-pg215.219.pdfhttp://www.yorku.ca/nuri/econ3500/ch7-binomial-combinations-pg215.219.pdf
8/9/2019 Ch7 Binomial Expansions
2/9
% si&e number in$icatin+ the sample si&e-
% replace lo+ical (TRUE./0E) *hether samplin+ $one *ith replacement-
% or$ere$ lo+ical (TRUE./0E) *hether or$er is important-
# “In how many distinct ways can we permute the order of ourn distinct # objects?” p. 21
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
"ase1:
with replacement (repetitions allowed ) an$ order matters
!1$3
urnsamples%& si'e ! 2& replace ! ()*+& ordered ! ()*+, & n'2
e$pand.grid"$($%
urnsamples(", si&e = 3, replace = TRUE, or$ere$ = TRUE) & n'n
e$pand.grid"$($($%
e$pand.grid")*++*,1:3()*++*,1:3%
& e$pand.grid")*++*,1:3()*++*,1:3()*++*,1:3%
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
"ase2
% *ithout replacement (no repetitions) an$ or$er matters %-+)*(/(I0,
% n *as o picin+ the irst in line
% (n 4 1) *as o picin+ the secon$ in line
% (n 4 2) *as o picin+ the thir$ in line
% - - -
% 1 *a o picin+ the last ob5ect
8/9/2019 Ch7 Binomial Expansions
3/9
% n(n 4 1)(n 4 2)(n 4 3) - - - 1
% This pro$uct is calle$ 6n actorial an$ is *ritten 6n89 that is
% n8 = n(n 4 1)(n 4 2)(n 4 3) - - - 1
% n R
% actorial(n)
factorial%3, % =!
factorial%, % = 2
!c%40ran5e4&46anana4&4-ear4&4/pple4, % pa5es 21218
urnsamples%& si'e ! & replace ! 9/:+& ordered ! ()*+,
% 2 permutations 8
% i *ith replacement (replace=TRUE) """=2;!
permutations%&&,
# "onsider a clearer case$ permutations of /& 6& "
"=c(
8/9/2019 Ch7 Binomial Expansions
4/9
uniue%urnsamples%& si'e ! & replace ! 9/:+& ordered ! ()*+,,
=======================================================================
"ase3:
*ithout replacement an$ or$er $oes not matter %"06I/(I0,
pa5e 21> in$istin+uishable ob5ects
% n=; r=2 (n43)=3 n8.(n4r)8=2A
"=c(
8/9/2019 Ch7 Binomial Expansions
5/9
Definition
!e factorial of an integer n $, written n%, is
n & n' & ... & 2 & .
n partic*lar, $% + .
“fo*r factorial”
“n factorial”
%+
!e following is epression (-.) on page 2
4!=1x2x3x4=24
In S-Plus the function factorial
factorial(4)[1] 24factorial(0:4)[1] 1 1 2 24
In S-Plus co"#inations$ ex%ression (&'1) on % 21 isthe function choose
choose(n*x)choose(4*2)[1] choose(4*0:4)
8/9/2019 Ch7 Binomial Expansions
6/9
[1] 1 4 4 1
+he %er"utations$ ex%ression on % 21,
[n!(n-r)!] is the function.hoose(n*r*or/er=+)choose(4*2*or/er=+)[1] 12
ascals +riangle "pgs 227 and 591-592 o te$t%
*$pand
Expression
+
Expression
+
Expression
(a #)4 = a4 4a3# a2#2 4a#3 #4
/pan0
8/9/2019 Ch7 Binomial Expansions
7/9
ascals +riangle ( pg 1 of tet) is a triangle of coefficients tat is base0 on te binomial teorem.
t is forme0 by a00ing te two n*mbers 0irectly aboe an0 placing s on te o*ter si0es.
2
3 3
4 5 4
1 $ $ 1
5 1 2$ 1 5
- 2 31 31 2 -
6 26 15 -$ 15 26 6
35 64 25 25 64 35
!e binomial coefficient epansion is as follows
/pan0 te following
8/9/2019 Ch7 Binomial Expansions
8/9
Expand
Expression
Result
In general,
Expression
Result
Expression
Result
"rele#ant te$t pages on combinations%
http://www.yorku.ca/nuri/econ3500/ch7-binomial-combinations-pg215.219.pd
http://www.yorku.ca/nuri/econ3500/ch7-binomial-combinations-pg215.219.pdfhttp://www.yorku.ca/nuri/econ3500/ch7-binomial-combinations-pg215.219.pdf
8/9/2019 Ch7 Binomial Expansions
9/9