!"#$%&($)*#+,-"./0"#(12/.*0"#*#+3*4*5#*.%6167148          9/:%*#+9                                      ;8*#<(*/(8$"#<    ...
F*6$612/.*0"#•  F"1+6:%;=*1<9$%#".+6•  !"+$.6*#12*.2"0"#648="/<8   612?.$=/.$6&=$6/.0#<1#G">H1#<   :$8*-1"=•  ,2$=<$#4:$8*...
L612?.$=/.$6•  ($?*=*0"#  –  !"-$4"*-"1+>="7+1#<1#48$     G">H•  5.1<#2$#4  –  !"-$1#48$6*2$+1=$>0"#*6     48$G">H•  ;"8$6...
(12/.*0"#6•    5=0M>1*.7"=.+>*..$+N4"?1*•    A"?/.*4$+:%O="1+6P•    Q=$$4"7*#+$=48="/<8*#1#M#14$.*#+6>*?$•    (12/.*0"#6*=...
F*6$612/.*0"#
5<$#4S:*6$+2"+$.1#< •  5.6"H#"7#*62/.0S*<$#4612/.*0"#•  5/4"#"2"/6*<$#461#4$=*>0#<7148$*>8"48$=*#+   48$$#-1="#2$#4•  R#G/...
,-"./0"#                 ($)        !"#$%F*6$
N(*-$=*<$1#>"2$W*$=4*)$6X5=$?"=4J="248$;"#<=$661"#*.F/+<$4]Z>$W;F]X?"1#46"/448*41#>"2$1#$^/*.14%1#52$=1>*8*6#"4=16$#+=*2*0...
Q*..J="2<=*>$
@"714:$8*-$6•  9"1+6#"78*-$*#$#$=<%.$-$.•  54$-$=%0>H&="1+6."6$E$#$=<%•  RJ$#$=<%.$-$.=$*>8$6D&1471..+1$•  V"?=$-$#44816&1...
Q1=64612/.*0"#
3*4*>"..$>0"#•  54$-$=%0>H=$>"=+48$$#$=<%.$-$."J$*>8   ="1+•  3"4816/#0.48$$#+"J48$612/.*0"#
,#$=<%.$-$.*#*.%616
]#48$+*%"J=$>H"#1#<!"64="1+6*=$+$*+                          5J$7="1+68*-$*                          ."4"J$#$=<%
U1#1>"$Z>1$#4*#+B"=$#Y>/=-$•  V8$U1#1>"$Z>1$#416*   2$*6/=$"J48$1#$^/*.14%"J   *+164=1:/0"#&D16?$=J$>4   $^/*.14%*#+E16?$=...
B"=$#Y>/=-$"#1#$^/*.14%b"42/>81#$^/*.14%                             5."4"J                             1#$^/*.14%c
,#$=<%dd2"#$%•  ]-$=*?$=1"+"J02$&*62*..?$=>$#4*<$"J   48$?"?/.*0"#<$46*?="?"=0"#"J48$$#$=<%•  e8*41648$>*/6$"J4816f
e8%48$1#$^/*.14%f•  @*=+7"=H*#+1#8$=$#44*.$#4g*:1.14%f  – 5..="1+6*=$48$(5!,•  ("2$./>H%="1+61a$a=*#+"2   +164=1:/0"#f  – ...
V8$=1>8<$4=1>8$=&48$?""=<$4                 ?""=$=•  F*>H4"78$=$7$64*=4$+I$2$=<$#4   :$8*-1"=•  (2*..>8*#<$6=1??.$+"7#4".*...
(?1>1#<481#<6/?71486$)•  9"1+68*-$<$#+$=#"7I2*.$*#+J$2*.$•  !*.$6*=$:./$&J$2*.$6*=$<=$%•  RJJ$2*.$1671481#>81.+:$*=1#<*<$W...
U=12=$*?$=*==1-$6•  e148:1=487$1#4="+/>$   +$*48•  ,*>8="1+8*6*=*#+"2.%   *661<#$+.1J$6?*#•  ,*>80>H1#>=$*6$648$*<$"J   48...
($>"#+612/.*0"#
3*4*>"..$>0"#•  e$7*#44"1#-$60<*4$8"748$?"?/.*0"#   >8*#<$6"#>$7$1#4="+/>$6$)*#++$*48•  54$-$=%0>H7$>"..$>448$?"?/.*0"#"J4...
3*4**#*.%616 A"?/.*0"# G/>4/*4$6
,)0#>0"#c             A"?/.*0"#G/>4/*0"#6             =$6/.0#<1#+16*64$=             W$)0#>0"#cX
e8*4j/648*??$#$+f•  R>8*#<$+*?*=*2$4$=S48$>81.+:$*=1#<*<$•  ]=1<1#*.  –  ;@RB3F,59RbUk5U,dCDaaiD•  ;8*#<$+  –  ;@RB3F,59Rb...
,#+"<$#"/6-6,)"<$#"/6•  5=$$)0#>0"#6W*#+"48$=>=1616$-$#46X6".$.%   +/$4"$)4$=#*.J*>4"=6W$)"<$#"/6Xf•  (12/.*0"#6/<<$6461#4...
,-"./0"#•  A=$-1"/6.%*..="1+68*-$48$6*2$*[=1:/4$6&"#.%   +1h$=$#>$162*)12/2.1J$6?*#*#+$#$=<%.$-$.•  R#4816612/.*0"#&7$*++C...
;="66"-$="J<$#$0>*[=1:/4$6•  e$J".."7-$=%612?.$!$#+$.1*#=/.$6J"=   >="66"-$=•  566/2$48$J*48$=8*648$<$#"4%?$W2&-X*#+   48$...
V81=+612/.*0"#
3*4*>"..$>0"#•  e$7*#44"M#+"/48"748$2$4*:".162*#+   -161"#=*#<$*[=1:/4$6"J48$?"?/.*0"#   >8*#<$6"-$=02$•  54$-$=%0>H&7$>*....
,-"./0"#1#*>0"#c!$4*:".162                                       l161"#=*#<$12?="-$6"-$=                                  ...
,-"./0"#$)?.*1#$+•  (/=-1-*."J48$M[$64I48$="1+6714848$   :$[$=*[=1:/4$6*=$*:.$4"6/=-1-$."#<$=   *#+=$?="+/>$71486121.*=*[=...
;"#>./61"#•  V8$=1>8<$4=1>8$=&*#+48$?""=<$4?""=$=   /#.$6648$6%64$216=$</.*4$+•  R#4$=#*.>8*#<$61#*#$>"6%64$2>*#,5(RBn   4...
!16>$..*#$"/664/h•  (12/.*0"#I9/:%*#+(8"$6•  5#*.%616I9&7148<<?."4C&1#$^•  ;"+$*-*1.*:.$1#U14@/:  8[?6ogg<148/:a>"2g6*/68$...
!"#$%&()&
Money, Sex and Evolution - Simulation and data analysis with Ruby and R
Money, Sex and Evolution - Simulation and data analysis with Ruby and R
Money, Sex and Evolution - Simulation and data analysis with Ruby and R
Money, Sex and Evolution - Simulation and data analysis with Ruby and R
Money, Sex and Evolution - Simulation and data analysis with Ruby and R
Money, Sex and Evolution - Simulation and data analysis with Ruby and R
Money, Sex and Evolution - Simulation and data analysis with Ruby and R
Upcoming SlideShare
Loading in …5
×

Money, Sex and Evolution - Simulation and data analysis with Ruby and R

2,973 views

Published on

Simulation and data analysis with Ruby and R

  • Be the first to comment

Money, Sex and Evolution - Simulation and data analysis with Ruby and R

  1. 1. !"#$%&($)*#+,-"./0"#(12/.*0"#*#+3*4*5#*.%6167148 9/:%*#+9 ;8*#<(*/(8$"#< 31=$>4"=&5??.1$+9$6$*=>8& @AB*:6(1#<*?"=$ 3$>CDEE
  2. 2. F*6$612/.*0"#•  F"1+6:%;=*1<9$%#".+6•  !"+$.6*#12*.2"0"#648="/<8 612?.$=/.$6&=$6/.0#<1#G">H1#< :$8*-1"=•  ,2$=<$#4:$8*-1"=I>"2?.$) :$8*-1"=*=161#<J="2612?.$=/.$6•  ,-$#4/*.:*616J"=6"2$"J48$2"=$12?=$661-$ >1#$2*4"<=*?81>*#12*0"#IB"=+"J48$91#<6& F*42*#9$4/=#6&B1"#K1#<$4>
  3. 3. L612?.$=/.$6•  ($?*=*0"# –  !"-$4"*-"1+>="7+1#<1#48$ G">H•  5.1<#2$#4 –  !"-$1#48$6*2$+1=$>0"#*6 48$G">H•  ;"8$61"# –  !"-$4"7*=+648$>$#4$="J48$ G">H
  4. 4. (12/.*0"#6•  5=0M>1*.7"=.+>*..$+N4"?1*•  A"?/.*4$+:%O="1+6P•  Q=$$4"7*#+$=48="/<8*#1#M#14$.*#+6>*?$•  (12/.*0"#6*=$>=$*4$+71489/:%/61#<48$ (8"$6NR4"".H14
  5. 5. F*6$612/.*0"#
  6. 6. 5<$#4S:*6$+2"+$.1#< •  5.6"H#"7#*62/.0S*<$#4612/.*0"#•  5/4"#"2"/6*<$#461#4$=*>0#<7148$*>8"48$=*#+ 48$$#-1="#2$#4•  R#G/$#>$+:%T"8#;"#7*%P6U*2$"JB1J$•  ,*=.1$645F!612/.*0"#6:%V8"2*6(>8$..1#<P6 W$>"#"2164X6$<=$<*0"#2"+$.•  V816?=$6$#4*0"#8$*-1.%1#G/$#>$+:%,?64$1#*#+ 5)4$..P6(/<*=6>*?$612/.*0"#6•  N6$+1#*#*.%61#<6/??.%>8*1#"?021Y*0"#&4=*Z> ?*[$=#6&$>"#"21>2"+$.6&6?=$*+"J$?1+$21>6
  7. 7. ,-"./0"# ($) !"#$%F*6$
  8. 8. N(*-$=*<$1#>"2$W*$=4*)$6X5=$?"=4J="248$;"#<=$661"#*.F/+<$4]Z>$W;F]X?"1#46"/448*41#>"2$1#$^/*.14%1#52$=1>*8*6#"4=16$#+=*2*0>*..%"-$=48$?*64CD%$*=6_78$#48$4"?E`"J$*=#$=6*=$$)>./+$+a
  9. 9. Q*..J="2<=*>$
  10. 10. @"714:$8*-$6•  9"1+6#"78*-$*#$#$=<%.$-$.•  54$-$=%0>H&="1+6."6$E$#$=<%•  RJ$#$=<%.$-$.=$*>8$6D&1471..+1$•  V"?=$-$#44816&1471..*>0-$.%6$$H"/4J""+ *#+>"#6/2$14•  ;"#6/21#<J""+=$?.$#168$6$#$=<%.$-$.•  WF/4="1+6*=$60..122"=4*.X
  11. 11. Q1=64612/.*0"#
  12. 12. 3*4*>"..$>0"#•  54$-$=%0>H=$>"=+48$$#$=<%.$-$."J$*>8 ="1+•  3"4816/#0.48$$#+"J48$612/.*0"#
  13. 13. ,#$=<%.$-$.*#*.%616
  14. 14. ]#48$+*%"J=$>H"#1#<!"64="1+6*=$+$*+ 5J$7="1+68*-$* ."4"J$#$=<%
  15. 15. U1#1>"$Z>1$#4*#+B"=$#Y>/=-$•  V8$U1#1>"$Z>1$#416* 2$*6/=$"J48$1#$^/*.14%"J *+164=1:/0"#&D16?$=J$>4 $^/*.14%*#+E16?$=J$>4 5=$*1648$*2"/#4 1#$^/*.14% "J1#$^/*.14%•  3$M#$+2*48$2*0>*..% :*6$+"#48$B"=$#Y>/=-$
  16. 16. B"=$#Y>/=-$"#1#$^/*.14%b"42/>81#$^/*.14% 5."4"J 1#$^/*.14%c
  17. 17. ,#$=<%dd2"#$%•  ]-$=*?$=1"+"J02$&*62*..?$=>$#4*<$"J 48$?"?/.*0"#<$46*?="?"=0"#"J48$$#$=<%•  e8*41648$>*/6$"J4816f
  18. 18. e8%48$1#$^/*.14%f•  @*=+7"=H*#+1#8$=$#44*.$#4g*:1.14%f – 5..="1+6*=$48$(5!,•  ("2$./>H%="1+61a$a=*#+"2 +164=1:/0"#f – RJ14P6=*#+"248$#1468"/.+J".."7*#"=2*. +164=1:/0"#
  19. 19. V8$=1>8<$4=1>8$=&48$?""=<$4 ?""=$=•  F*>H4"78$=$7$64*=4$+I$2$=<$#4 :$8*-1"=•  (2*..>8*#<$6=1??.$+"7#4".*=<$$h$>46 "-$=*?$=1"+"J02$•  (12?.$.">*.=/.$6:=1#<6>"2?.$)<.":*. >8*#<$6
  20. 20. (?1>1#<481#<6/?71486$)•  9"1+68*-$<$#+$=#"7I2*.$*#+J$2*.$•  !*.$6*=$:./$&J$2*.$6*=$<=$%•  RJJ$2*.$1671481#>81.+:$*=1#<*<$WCD4"iD 0>H6X*#+1J148*6$#"/<8$#$=<%&1471...""HJ"=* #$*=:%2*.$•  RJ2*.$16*.6"71481#>81.+:$*=1#<*<$*#+8*-$ $#"/<8$#$=<%&48$%71..?=">=$*4$*#+?="+/>$ *:*:%="1+•  F"482*.$*#+J$2*.$."6$6$#$=<%$*>802$ 48$%?=">=$*4$
  21. 21. U=12=$*?$=*==1-$6•  e148:1=487$1#4="+/>$ +$*48•  ,*>8="1+8*6*=*#+"2.% *661<#$+.1J$6?*#•  ,*>80>H1#>=$*6$648$*<$"J 48$="1+•  9"1++1$678$#14=$*>8$6146 .1J$6?*#
  22. 22. ($>"#+612/.*0"#
  23. 23. 3*4*>"..$>0"#•  e$7*#44"1#-$60<*4$8"748$?"?/.*0"# >8*#<$6"#>$7$1#4="+/>$6$)*#++$*48•  54$-$=%0>H7$>"..$>448$?"?/.*0"#"J48$ $#0=$7"=.+&*67$..*6?"?/.*0"#"J2*.$6 *#+J$2*.$6
  24. 24. 3*4**#*.%616 A"?/.*0"# G/>4/*4$6
  25. 25. ,)0#>0"#c A"?/.*0"#G/>4/*0"#6 =$6/.0#<1#+16*64$= W$)0#>0"#cX
  26. 26. e8*4j/648*??$#$+f•  R>8*#<$+*?*=*2$4$=S48$>81.+:$*=1#<*<$•  ]=1<1#*. –  ;@RB3F,59RbUk5U,dCDaaiD•  ;8*#<$+ –  ;@RB3F,59RbUk5U,dCiaaiD
  27. 27. ,#+"<$#"/6-6,)"<$#"/6•  5=$$)0#>0"#6W*#+"48$=>=1616$-$#46X6".$.% +/$4"$)4$=#*.J*>4"=6W$)"<$#"/6Xf•  (12/.*0"#6/<<$6461#4$=#*.J*>4"=6 W$#+"<$#"/6X*=$$#"/<84"4=1<<$=>=16$648*4 >*##"4:$=$>"-$=$+•  ]48$=>=16$6>*#:$2*??$+IM#*#>1*. >=*68$6W$)4$=#*.J*>4"=6"=1#8$=$#4 1#64*:1.14%fX&6">1*./#=$64W$)4$=#*.*<$#46"= 1#4$=#*.166/$6fX$4>
  28. 28. ,-"./0"#•  A=$-1"/6.%*..="1+68*-$48$6*2$*[=1:/4$6&"#.% +1h$=$#>$162*)12/2.1J$6?*#*#+$#$=<%.$-$.•  R#4816612/.*0"#&7$*++C#$7*[=1:/4$6 –  !$4*:".162 @"77$..48$="1+>"#-$=4648$J""+14$*461#4"$#$=<%W81<8$= #/2:$=:$[$=X –  l161"#=*#<$ @"7J*=*7*%14>*#6$$J""+W81<8$=#/2:$=:$[$=X•  9"1+:*:1$61#8$=1448$6$C*[=1:/4$6J="248$1= ?*=$#46
  29. 29. ;="66"-$="J<$#$0>*[=1:/4$6•  e$J".."7-$=%612?.$!$#+$.1*#=/.$6J"= >="66"-$=•  566/2$48$J*48$=8*648$<$#"4%?$W2&-X*#+ 48$2"48$=8*6<$#"4%?$W!&lX•  A"661:.$<$#"4%?$6"J:*:%*=$W2&-X&W2&lX& W!&-X*#+W!&lX•  e$=*#+"2.%>8"6$E"J48$6$m?"661:1.10$6
  30. 30. V81=+612/.*0"#
  31. 31. 3*4*>"..$>0"#•  e$7*#44"M#+"/48"748$2$4*:".162*#+ -161"#=*#<$*[=1:/4$6"J48$?"?/.*0"# >8*#<$6"-$=02$•  54$-$=%0>H&7$>*.>/.*4$48$*-$=*<$ 2$4*:".162*#+-161"#=*#<$"J*..="1+648*4 *=$60..*.1-$
  32. 32. ,-"./0"#1#*>0"#c!$4*:".162 l161"#=*#<$12?="-$6"-$= 12?="-$6"-$=02$ 02$
  33. 33. ,-"./0"#$)?.*1#$+•  (/=-1-*."J48$M[$64I48$="1+6714848$ :$[$=*[=1:/4$6*=$*:.$4"6/=-1-$."#<$= *#+=$?="+/>$71486121.*=*[=1:/4$6•  ,-"./0"#16#"4#$>$66*=1.%*64=*1<84.1#$ W-161"#=*#<$2$*#+$=6J"=*781.$X
  34. 34. ;"#>./61"#•  V8$=1>8<$4=1>8$=&*#+48$?""=<$4?""=$= /#.$6648$6%64$216=$</.*4$+•  R#4$=#*.>8*#<$61#*#$>"6%64$2>*#,5(RBn 4=1<<$=>=16$648*4>*##"4:$=$>"-$=$+•  ,-"./0"#16#"4*.7*%6*64=*1<84.1#$
  35. 35. !16>$..*#$"/664/h•  (12/.*0"#I9/:%*#+(8"$6•  5#*.%616I9&7148<<?."4C&1#$^•  ;"+$*-*1.*:.$1#U14@/: 8[?6ogg<148/:a>"2g6*/68$"#<g$-$=%+*%•  8[?ogg:."<a6*/68a>"2•  6*/68$"#<p<2*1.a>"2S?$=6"#*.•  6*/68$"#<p8?a>"2S7"=Hg@A=$.*4$+
  36. 36. !"#$%&()&

×