FES 720 Introduction to R

LAB: Testing Ratios

This is the lab associated with the lecture and lesson on Testing Ratios in R.

Please upload your final completed lab on the Assignments page in Canvas, as per the instructions below.

You are welcome and expected to ask for help from the instructors if you get stuck: Please also come to the R Bootcamp on Friday—there is coffee and snacks!


Questions

A. Fish populations

A fish survey is done to see if the proportion of fish types is consistent with previous years. Suppose, the 3 types of fish recorded: parrotfish, grouper, tang are historically in a 5:3:4 proportion and in a survey the following counts are found:

Fish pf gr ta
observed 53 22 49

Have the proportions of each species changed?

B. Birds

In October of 2015, Jane saw 12 black-capped chickadees, 2 red-bellied woodpeckers, and a canada goose in my back yard. This year, she saw 10 back-capped chickadees, 5 red-bellied woodpeckers, and 1 zebra. Has the bird population changed significantly?

C. Flowering trees

Here is Table 1 from my paper Queenborough et al. 2007. Determinants of biased sex ratios and inter-sex costs of reproduction in dioecious tropical forest trees. Am J Bot 94, 67–78.

Table 1. Flowering and cumulative sex ratios (proportion of males) for 16 tree species of Myristicaceae on the Yasuní Forest Dynamics Plot. dbh = minimum dbh of stem censused; Ntot = total no. trees censused; Nrep = no. trees that flowered in a given year or set of years. Significance denoted by asterisks: * P < 0.05; ** P < 0.01; *** P < 0.001 (G test for random deviation of sex ratios from 1:1).

  1. Make a data frame, copying the data (proportion male and number of reproductives) for all four years for the following species: Iryanthera hostmanii, Otoba glycycarpa, Virola duckei, Virola elongata, Virola pavonis, and Virola calophylla.

  2. Add two additional columns, for number of males and number of females. Generate the values within R using the data from Q1.

  3. Which species showed significantly male-biased sex ratios in 2002?

  4. Was Iryanthera hostmannii male-biased in all years?

  5. Was the sex ratio of all reproductive trees pooled male- or female-biased?

D. Sparrows

Download the sparrow data

dat <- read.table(file = "http://www.simonqueenborough.info/R/data/sparrows.txt", header = TRUE)
  1. Look at the first rows of data, and the stucture of the dataframe.

  2. Are there more male or female sparrows?

  3. Make a contingency table of the number of male and female sparrows of different ages.

  4. Are male sparrows older than female sparrows? (i.e., are the proportions in each age class different?)

  5. Does this pattern apply in both species?

  6. Make a figure to illustrate the proportions of sparrows of different age and sex in both species.


How to write up your answers

Please check the help page for a reminder, if you need to.


Updated: 2017-11-03