The purpose of this tutorial is to investigate how the species richness of plant communities influences the biomass produced by those communities.
We will be working a dataset that includes observations on the species richness and above-ground biomass production of study plots of plant communities. The data used in this analysis is contained in the csv file BIOL416_Tutorial5_BEFData.csv, which can be downloaded off of Canvas in the Tutorial 5 folder or at this link.
Try to follow these steps on your own first, but don’t worry if you get stuck. We will go through the analysis together as a class, step-by-step, after you have a chance to try each stage of analysis.
Start up a new R script and load the .csv file into your R session - you can do this using the file.choose()
function we have used previously, or by using file paths in your R script. Click here for more information on using file paths in R.
Examine the BEF data. What data are represented in columns? In rows? What data populates the data frame?
We want to find out if there is a significant relationship between species richness (SR) and biomass production (B) in these plant communities. To test for statistical significant, we will conduct two linear regressions between SR and B: one in which SR is transformed by the natural logarithm, ln, and another where SR is in its raw state.
To do this, we will:
Run a linear regression of both: \[Biomass \sim m * Richness + b\] \[Biomass \sim m * ln(Richness) + b\] …where \(m\) is the coefficient/slope for \(Richness\) and \(b\) is the y-intercept of the linear regression.
Interpret and plot the results of (b)
Question: Why are we interested in comparing ln-transformed and un-transformed species richness data?
X2
. Create a data frame that includes only observations for plot X2
.Hint: take a look at the subset()
function if you’re stuck.
Calculate the species richness in the X2
plot. SR changes year-per-year in some plots; only calculate SR for the first year of observations!
Calculate the average biomass production (averaged across all years of observation) in X2
.
Repeat steps 1-3 for the remaining plots.
Hint: You should not do this by hand! we can use a for()
loop for this. If you don’t know what a for-loop is, stop here - we will review this as a class. If you’re feeling ambitious, you can read about how to write a for-loop here.
Don’t forget to store your results somewhere! Make a data frame of your BEF values including the Plot ID, species richness, and biomass production for each plot. It is easiest to do this before you run the loop in Step 4.
Create and run a linear model that looks at:
Biomass as a function of species richness \[Biomass \sim m * Richness + b\]
Biomass as a function of ln-transformed species richness. Hint: in R, log(X)
takes the natural logarithm of some object, X. log10()
is used to take the base-10 logarithm that you’re probably used to. \[Biomass \sim m * ln(Richness) + b\]
Plot each of these relationships with a scatterplot and overlay the linear relationships created in Step 6 on the data.
Interpret these relationships - what do the coefficients and intercepts tell us about species richness and how it influences biomass production?
Compare the ability of the ln-transformed and untransformed species richness to predict biomass production.
Hint: you can do this by considering the Multiple R-squared
result from the linear model objects created in Step 6; we will discuss what R-squared is in class if you are unfamiliar.