You if you have a situation where you want to do more than a simple ANOVA, simple, ANOVA might compare one factor with multiple categories or multiple levels that we often talk about it. But what about the case where you have a data set like, for example, this one that's up shown in the upper panel here in this data set I have two factors elevation and condition. And then I have actually three response variables that I might want to look at one at a time and I might have hypotheses about each. So. These data come from data collected by field ecology, students on Mount rose, which is mountain, and the southern Olympics Mount Rose had a fire in 2006 that burned up the side of a mountain and conveniently burned about half of a mountain and not the other half.
So it's really easy to walk up a trail that bisects the fire line and sample on one side and get burned samples. And on the other side, get unburned samples and compare them with elevation. And in this study, the students went and looked at.
Stem growth of salad plants. They looked at pathogen number on solo Valkyrie so shell on plants. And they looked at the number of spiders on goth area shell on plants. In each case, they had a separate hypothesis about how stem growth pathogens. And number of spiders would respond to elevation, and we respond to the condition burned or unburned. So in the previous example, we just had species predicting height. Now, let's take stem growth as our first variable.
And we want to know how both elevation and. Condition affect stem growth. So the first thing you need to do as always is import your data set. So this is the data set that is most likely similar to what you have in your folder that you'll be running for your lab. Okay. Now to the heart of the matter. All of this has just been gabbing about general kind of framework sort of study, and what we want to do.
But you'll, remember before we did a simple ANOVA, and we were able to do a simple ANOVA on seedling hike by species. First we were plotted. What we were looking for then we did an AO ve command to look at the analysis event to make sure an analysis of variance was run. Then we stored that command in a word. And then we created a table from we can do the same thing with our data on rows here. So we call this rose. But what we might want to do instead is rename this data set, of course, roses even a shorter word.
So it doesn't really matter. Now data set contains all the rows' data here. So I'm, ready to do that.
I'm also ready to do an AO v. Command so I can do an AO V on the rows' data. In this case, I'm going to do an AO V on stem growth as predicted by elevation. And in this case, I'm going to multiply by condition that multiplication will give me a full factorial analysis where it's going to analyze elevation it's going to analyze condition, and it's going to see how the interaction of those two effects stems grows, and I'm going to use the data equals command to tell it that I'm looking at the data, stored in data, set I'm going to skip a. Step from what I did before because I already know, I want to store the center term, and then I want to use the ANOVA command on it, which I could actually do in all one command, but let's, take this one step at a time, I'm going to call the stamen ova and I want stem ANOVA to store this command. So take a minute to write down this command, if you haven't already going to hit enter. And now stem ANOVA is complete.
And all I have to do is type ANOVA stem ANOVA. You see it prompts up here's. My analysis is a. Variance table for the complete analysis, and you'll see that elevation and condition are both significant factors and elevation by condition is also if I use my up arrow to go back through my previous commands, I can also just go through and type plot here to plot.
My data, it'll prompt me to hit enter to see each plot one at a time there's, my elevation plot and there's, my burned and burned plot. So a little earlier I went to how to create an ANOVA for multiple factors and look at their interactions. Here, we're looking at the ANOVA output table in our studio and the effects associated with that. And then we slightly changed our script to just say plot for box plot might work too. And that gave us a series of graphs that were plots. Both of the factors that we were looking at in this case elevation high and low and see the graph here on the right affecting stem growth. And we can do the same thing for burned and unburned condition, but there's a problem, because we also might want to look at how.
These things interact or don't interact as the case may be. So it turns out there's another function that we can use, and it's called interaction dot plot so down at the bottom of your screen. You'll see some script I'm going to expand this window here, a little. So we can see what we're dealing with this script is the interaction dot plot script. And you might remember from an earlier lab that there are a couple of different ways to call up a given variable and a data set. One of them is to use the.
Plot function like we did earlier where we specify the data set by the data equals command at the end at the end of our script here and that's one way to tell our what data you want to work with. So you can name the variables. And then afterwards say, here's, the data set that those are in. But another way to do that is to use the dollar sign command within the script itself. So this is especially handy if you're working across multiple data file.
So for example, I could have written data set. Dollar sign stem growth and data set dollar sign elevation in data, set dollar sign condition, and then I wouldn't need the data equals command, and then I should get roughly the same graphs. So it's going to have me run each plot one at a time you see it's producing the same graphic for me. So the dollar sign command is a really handy command. And it also allows you to make sure that you're getting the spelling exactly right.
So you get an auto prompt for the data set you're working with you get an auto. Prompt for the variable in that data set as you begin to type it so data set. And if I'm typing stem growth, I start typing St M, and it should eventually, yes. It seems that I want stem growth, and it'll auto prompt me to fill that out so that's, a handy way to make sure you don't have typos. Okay. But we want to look at something more complex, which is an interaction block. So in our ANOVA you'll, remember that we had elevation as a factor of condition as a factor and elevation multiplied by.
Condition as a factor, how do the two interact? In other words do the condition affect change depending on what elevation you're at you can imagine that the effect of burning and high elevation could be different from the effect of burning at low elevation. So again, the effect of burning high elevation could be lower than the difference in the effected low elevation in this particular example, we already have a probability score that tells us it's, not the case, but it can be helpful to see it. So. I'm going to run this code. Instead, the interaction dot plot code, and I'm going to take Rose elevation and Rose condition as factors impacting Rose stem growth. So there's a little different way of writing it out, and you're used to in the plot commands, instead of the tilde specifying, what is going to predict a why we're actually listing our prediction and interaction variables first, and then we're listing the thing that we want to have predicted.
So our independent variables first and been our dependent. Variable I've, added some script in here that allows me to specify the name for the x-axis and the y-axis and then a label for a line that I'm going to plot so let's, see what happens when I get enter here? Okay, so I get a graph. And in this case, this graph showing me two lines for each treatment burned and unburned. And one thing that gets a little of knowing in our is you'll, notice that as we resize this window, the script and the graphic are going to automatically resize. So let's, look at this.
More the way it might look if we were going to save it as an image we can go through, and we can adjust things like the width I, especially like the copy to clipboard command, because it gives me a lot of options. But you'll, notice it's its, putting my axis label in a place, that's kind of hard to or my treatment label in a place, that's kind of hard to interpret. So you might have to mess with that to get that to work just right, so I'll leave that to you and another and your exploratory capabilities.
We. Can move around that label if we'd like to.
Dated : 09-May-2022