These labs test and build on the material presented in the SWIRL lessons.
Scroll down or click here to to check how to submit them.
Lab 1 and 2: 2018-10-05 23:58
Lab 3 and recap: 2018-10-12 23:58
(no best practice lab)
a. We have counts for three tree species before and after a fire, and want to know whether the fire changed their relative abundance.
b. We have data on total lifetime income and age of mortality, and want to know whether there is a relationship between the two.
c. We sampled soil organic nitrogen content in 30 random plots across 4 different sites, and want to know whether average soil nitrogen differs between each site.
For bonus points… d. Our survey respondents answered either
no when asked whether they believed in anthropogenic climate change, and we want to know whether their age has an effect.
The class survey data are found on the Data page.
a. Which variables are continuous?
b. Which variables are categorical? Are any binomial (do any have only 2 levels)?
c. Check the distribution of class height and number of Harry Potter books read. Do they appear normally distributed? Note that you can use the
breaks argument in
hist() if you want to decrease the bin size of your histogram.
d. Plot ideal temperature. Add relevant axis labels. Are there any outliers?
a. We want to compare mean diameter at breast height (dbh) between each species. Assess visually whether DBH is normally distributed.
b. Assess visually whether there is equal variance in DBH between each species.
c. Based on these tests, do you think an ANOVA is an appropriate test comparing average dbh in each species?
d. Enter the following code: ` m1 <- aov(dbh ~ species, data = data_name)` where data_name is the name of your data frame. You just performed an ANOVA!
e. Plot the model residuals as a function of the fitted values (remember
~ from the lesson). Does it seem like our model fit the data?
f. Make a boxplot of dbh as a function of species. Add relevant axis labels.
hist(), tabulate the following.
a. From the New Haven road race data:
i. the number of people running who were and were not from New Haven,
ii. ten equal-sized categories (i.e., bins of equal range) of running time,
iii. the number of people of each gender in each age category.
b. From the Michigan tree data:
i. the number of trees in each species,
ii. the number of trees greater and less than 1 meter dbh,
iii. the number of trees per species that are alive versus dead.
c. From the class survey data:
i. The number of people in each House,
ii. the number of people of each eye colour,
iii. the number of people of each eye colour and House,
iv. the number of people less than 1 meter, 1–2 meters, and >2 meters tall,
v. the number of people who can roll/not their tongue and number of siblings.
In the October of 2015, Jane saw 12 black-capped chickadees, 2 red-bellied woodpeckers, and a canada goose in her back yard. This year, she saw 10 back-capped chickadees, 5 red-bellied woodpeckers, and 1 zebra. Has the bird population changed significantly?
John studies the reproductive phenology of trees. In 2014, 59 male trees flowered and 34 female trees.
i. Is this population male-biased?
ii. In 2015, 71 male trees flowered and 39 female trees. Had the proportion of male-flowering trees changed?
was 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:
Have the proportions of each species changed?
a. Is the ratio of people who like tea to coffee 50:50?
b. Your TA, Andrew, loves pineapple on his pizza—prior to this class, he was the only one we knew about. Using class responses, test whether Andrew is truly the only one who likes pineapple on his pizza.
c. Do people with shoe sizes over 10 prefer pineapple on their pizza?
*apply() group of functions to answer the following questions.
Each question should require only one line of code, once the data are read in.
a. The mean and standard deviation of dbh of each species, for all trees.
b. The mean and standard deviation of dbh of each species for alive and dead trees.
c. The number of trees of each species that are alive and dead.
a. Mean race time for all genders.
b. The fastest race time for each age class.
c. The number of runners in each age class-gender combination.
a. The median shoe size of people in each House.
b. The mean height of folks according to whether they prefer tea or coffee and whether they can roll their tongue.
c. The maximum home town population of people according to their preferred vacation, pizza topping, and favorite color.
Use the sparrow data (see the Data page).
Read in the data.
Perform the appropriate test, and create an appropriate plot to visualize. The barplot() function may be helpful here.
Perform the appropriate test.
Check assumptions, perform the appropriate test, and create an appropriate plot to visualize.
Check assumptions and perform the appropriate test. Be sure that your observer variable is properly encoded as a factor.
Perform the appropriate test and interpret the model output. Run a post-hoc test if needed.
You will need to write R code to answer each of the questions.
Please format your answers as follows:
Copy and paste each question, commented out. This ensures that we know which answer corresponds to which question.
Write your R code answer below each question.
It should look something like this:
# LAB: Unit 1. Lab 1 # Your Name # Put your name here # 1. Add 7 and 3,456. 7 + 3456 # 2. Assign this value to an object x <- 7 + 3456
Log into Canvas.
Go to the Assignments page.
Under ‘Labs’, you should find the correct assignment.
Copy and paste your R code into the text box.
Click ‘Submit Assignment’.
You are permitted to submit your answers as many times as you like within each Unit.
Answers will be graded two or three times a week and re-opened if you submit early.
Each lab will close at its respective deadline (see Canvas).
Final grades for each lab will be computed and entered into the Canvas gradebook at the end of each Unit.