Panda Village

  1. Po visits the Panda Village. He captures 10 pandas and marks their butts with paint.

  2. A week later he returns to the village and captures 15 pandas. Five of these 15 pandas have paint on their butts, indicating that they are recaptured pandas.

  3. Can you guess/estimate the total numbers of pandas in the Panda Village?

    Poll:

    • \(N=20\) 🐼

    • \(N=30\) 🐼

    • \(N=40\) 🐼

Based on maximum likelihoodk, what N would you pick if you recapture 4, 5 or 6 pandas?

hyperLik <- function(N,M,n,m){dhyper(m,M,N-M,n)}
possibleN <- 20:40
likelihoods <- hyperLik(possibleN, 10, 15, 5)
plot(possibleN,likelihoods,
     type="l", 
     ylab="Likelihood",
     xlab="N",
     main = "Likelihood of N")

For more information aobut Mark and recapture, you may read Wikipedia: Mark and recapture.

Lab Assignment 3 (Lab projects?)

  1. Go though LabAssignment3.pdf LabAssignment3.pdf

  2. Download and open LabAssignment3.Rmd LabAssignment3.Rmd in RStudio and run codes inside. Things should be exactly same as LabAssignment3.pdf.

  3. Download, open LabAssignment3_otg.Rmd LabAssignment3_jp.Rmd and save as a new Rmd file for your own Lab Assignment submission. Knit this Rmd file to see if you can make a html, pdf or words. If you couldn’t, just use RStudio Cloud or the Binder RStudio Binder set by Po.

  4. Run/add/edit/delete the codes in your own copy of LabAssignment3_jp.Rmd and add/edit/delete some writings. Knit to see how the .pdf looks like. Tidy up the codes and writings. Knit and submit!

Help/Documentation

Read the R Documentation of the functions you learn today. Enter the following codes, one by one, and read the corresponding documentation/help in the Help tab.

?dhyper
?plot
?which.max
?read.table
?c
?head
?mean
?sd
?summary
?hist
?table
?mosaicplot
?boxplot
?aggregate

How Po knows all those built-in functions in R?

  • Way 1: Google it

  • Way 2: Read R Help/Documentation

There is no secret ingredient. – Mr. Ping 🍜

R tutorials that help you survive in Panda Village 🎍