Palmer Penguins [TEACHER NB]
Palmer Penguins [TEACHER NB]
AP Research CT [Biology]
JulianJacklin
In this lesson, students learn to apply computational thinking to biological data using the Palmer Penguins dataset. Aligned with the AP Research QUEST Framework, students will practice generating aligned research questions, evaluating data types, analyzing data distributions, and interpreting empirical results through statistical modeling.
Lesson Overview
- Warm-up: Research Question (10 minutes)
- Activity 1: Data Collection (5 minutes)
- Activity 2: Data Visualization (15 minutes)
- Activity 3: Results (15 minutes)
- Cool-down: Next Steps & Limitations (15 minutes)
Teacher-Facing Goals
- Question and Explore (LO 1.1A): Formulate a specific, feasible, and discipline-aligned biological research question using available data variables.
- Synthesize Ideas (LO 4.2A): Interpret and synthesize quantitative data outputs (Linear Regression and ANOVA) to develop and support an empirical argument.
Student-Facing Goal
Let's use programming code and statistical models to answer our own biological research questions about penguins.
Learning Target
I can design a specific research question, choose the best visualization to show data trends, and use statistical tables to prove my empirical conclusion.
Required Materials
- Internet-enabled device.
- Wolfram Language environment (cloud or desktop).
In this lesson, students learn to apply computational thinking to biological data using the Palmer Penguins dataset. Aligned with the AP Research QUEST Framework, students will practice generating aligned research questions, evaluating data types, analyzing data distributions, and interpreting empirical results through statistical modeling.
Lesson Overview
- Warm-up: Research Question (10 minutes)
- Activity 1: Data Collection (5 minutes)
- Activity 2: Data Visualization (15 minutes)
- Activity 3: Results (15 minutes)
- Cool-down: Next Steps & Limitations (15 minutes)
Teacher-Facing Goals
- Question and Explore (LO 1.1A): Formulate a specific, feasible, and discipline-aligned biological research question using available data variables.
- Synthesize Ideas (LO 4.2A): Interpret and synthesize quantitative data outputs (Linear Regression and ANOVA) to develop and support an empirical argument.
Student-Facing Goal
Let's use programming code and statistical models to answer our own biological research questions about penguins.
Learning Target
I can design a specific research question, choose the best visualization to show data trends, and use statistical tables to prove my empirical conclusion.
Required Materials
- Internet-enabled device.
- Wolfram Language environment (cloud or desktop).
Research Question
Research Question
Background
Background
Gorman et al. (2014) asked one specific question: do male and female penguins differ physically, and does that depend on species or environment? But the dataset itself, including bill measurements, flipper length, body mass, species, sex, island, and year, can support many other questions the authors never asked. [TEACHER FACING]By this point, student's should have already read and analyzed the research paper associated with this module. Methods of instruction for that activity are left to the discretion of the educator, as completion of the critical majority of this module does not rely on the primary document. Every module in the AP Research CT series uses its primary document as a backdrop for conducting computational work with real-world applications. The accompaniment of the primary document also allows AP Research instructors to simultaneously satisfy more traditional curricular goals, such as reading and analyzing research papers.
Consider this!
Consider this!
To generate your own question, think about:
Swapping the outcome - Instead of body measurements, ask about species differences.
Swapping the grouping variable - Compare by island instead of sex.
Change the relationship - Test whether one variable predicts another (e.g., flipper length → body mass) instead of comparing groups.
And before finalizing, check your question:
- Can it be answered with variables that actually exist in the data?
- Is it specific (names exact variables/comparison)?
- Is there enough data in each group (as in groups of penguins) to compare meaningfully?
[TEACHER-FACING]
If a student decides to use a variable not included in the list above, then their code will run them an error later in the module. However, this could serve as an important learning moment, so long as they are redirected at some point toward choosing variables that are available in the dataset.
A note on redirection: If a student chooses "penguin height" as a variable, for instance, encourage them to tell you more about that variable. Do the researchers talk about height? Is height included in the list of variables? Students should firmly understand the limitations of the data they are working with, but should also be encouraged to think deeply about how extending a research sample (to include, for instance, a height variable) could actually be meaningful in practice.
Here are some useful sentence frames and examples that will fit perfectly into the rest of the module. At their core, students should align with the following:
1) Swapping the outcome - "Does antarctic penguin [INSERT QUANTITY VARIABLE] differ by species?"
2) Swapping the grouping variable - "Do penguins of the same island share similar [INSERT QUANTITY VARIABLE]?"
3) Change the relationship - "Can [INSERT QUANTITY VARIABLE] be used to predict [INSERT ANOTHER QUANTITY VARIABLE]?"
EXAMPLES:
- Does antarctic penguin bill length differ by species?
- Do penguins of the same island share similar body mass?
- Can bill depth be used to predict bill length?
Swapping the outcome - Instead of body measurements, ask about species differences.
Swapping the grouping variable - Compare by island instead of sex.
Change the relationship - Test whether one variable predicts another (e.g., flipper length → body mass) instead of comparing groups.
And before finalizing, check your question:
- Can it be answered with variables that actually exist in the data?
- Is it specific (names exact variables/comparison)?
- Is there enough data in each group (as in groups of penguins) to compare meaningfully?
[TEACHER-FACING]
If a student decides to use a variable not included in the list above, then their code will run them an error later in the module. However, this could serve as an important learning moment, so long as they are redirected at some point toward choosing variables that are available in the dataset.
A note on redirection: If a student chooses "penguin height" as a variable, for instance, encourage them to tell you more about that variable. Do the researchers talk about height? Is height included in the list of variables? Students should firmly understand the limitations of the data they are working with, but should also be encouraged to think deeply about how extending a research sample (to include, for instance, a height variable) could actually be meaningful in practice.
Here are some useful sentence frames and examples that will fit perfectly into the rest of the module. At their core, students should align with the following:
1) Swapping the outcome - "Does antarctic penguin [INSERT QUANTITY VARIABLE] differ by species?"
2) Swapping the grouping variable - "Do penguins of the same island share similar [INSERT QUANTITY VARIABLE]?"
3) Change the relationship - "Can [INSERT QUANTITY VARIABLE] be used to predict [INSERT ANOTHER QUANTITY VARIABLE]?"
EXAMPLES:
- Does antarctic penguin bill length differ by species?
- Do penguins of the same island share similar body mass?
- Can bill depth be used to predict bill length?
My Question:
My Question:
Data Collection
Data Collection
Methodology
Methodology
How do the researchers collect data? What are two important considerations for collecting said data? These can be of your own making, or directly from the study.
[TEACHER-FACING]
Students are expected to refer to the research paper to identity that the penguins were sourced from three specific islands: Biscoe, Dream, and Torgersen. Additionally, each was targeted (adults during their nesting stages), captured, tagged, and measured. Discussion around considerations should be peer-facilitated, whether in a group or whole-class fashion where and when applicable. This is so that students can engaged in more depth with the topic of research methodology, and come to a shared intuition around data collection. Such considerations may include double-counting bias—where a single penguins may accidentally be counted multiple times—and measurement variation (one scientist's method for measuring a penguin's bill may be different than another's, causing slight inaccuracies throughout the data).
[TEACHER-FACING]
Students are expected to refer to the research paper to identity that the penguins were sourced from three specific islands: Biscoe, Dream, and Torgersen. Additionally, each was targeted (adults during their nesting stages), captured, tagged, and measured. Discussion around considerations should be peer-facilitated, whether in a group or whole-class fashion where and when applicable. This is so that students can engaged in more depth with the topic of research methodology, and come to a shared intuition around data collection. Such considerations may include double-counting bias—where a single penguins may accidentally be counted multiple times—and measurement variation (one scientist's method for measuring a penguin's bill may be different than another's, causing slight inaccuracies throughout the data).
Import
Import
To work with our data, we need to first import it into our environment—meaning, we just need to have it on our screen, to be able to work with it. Fortunately, this dataset already exists within the Wolfram Data Repository, so we need not do much to grab it for ourselves. Run the following line of code to view the dataset.
In[]:=
data:=ResourceData["Sample Tabular Data: Palmer Penguins"]data
Out[]=
Tabular
How many penguins were observed in this study as shown by the data? How many variables were used, and what were they? You should use the Dimensions and ColumnKeys functions to help answer these questions
Hint! You can begin typing any function in Wolfram Language input, and info will appear that may help you understand how to use it.
[TEACHER-FACING]
Below is the code students should be running to get their answers:
Hint! You can begin typing any function in Wolfram Language input, and info will appear that may help you understand how to use it.
[TEACHER-FACING]
Below is the code students should be running to get their answers:
In[]:=
Dimensions[data]
Out[]=
{333,9}
ColumnKeys[data]
Out[]=
{index,species,island,bill_length,bill_depth,flipper_length,body_mass,sex,year}
The first output tells us that there are 333 rows (or penguins) and 8 columns (or variables). The second input provides us a list of all the variables in the dataset and how they should be written.
Data Visualization
Data Visualization
Variables
Variables
Before visualizing anything, lets first identify what variables we'd like to use to answer our research question, and take note of how they are written in the dataset (BIll Length is not the same as bill_length—why do you think that is?).
grouped=GroupBy[data,Key["INSERT GROUPING VARIABLE"]];
[TEACHER-FACING]
Ensure that the variables students choose align with the ones they used in their research question. Here are the names of those variables as they should be inserting them:
[TEACHER-FACING]
Ensure that the variables students choose align with the ones they used in their research question. Here are the names of those variables as they should be inserting them:
{"index","species","island","bill_length","bill_depth","flipper_length","body_mass","sex","year"}
So, in the line of code above where we are creating a variable called "grouped", students should only be using either "island" , "species", or "year". These are the only variables that group the penguins by some common factor (i.e. all penguins from the same island; all penguins observed in 2007; all penguins of the Chinstrap species). If I were to use species as my grouping variable, the code would like like such:
In[]:=
grouped=GroupBy[data,Key["species"]]
Out[]=
Adelie,Gentoo,Chinstrap
Tabular
Tabular
Tabular
The students will need this for later, so unless an error appears, you can move swiftly on from this step.
Graphing
Graphing
Graphs and plots allow us to communicate trends in data clearly, typically catering towards wider audiences (why might this be?). In WL, there are several ways to plot data. Using the dataset and your chosen variables, your task is to determine which of the plots below communicates trends in your data the best (i.e. which graphs work, and which give you an error).
In[]:=
ListPlot[Normal/@(#[All,{"INSERT X VARIABLE","INSERT Y VARIABLE"}]&/@grouped),PlotLegendsKeys[grouped],PlotLabel"Scatterplot",FrameLabel{"INSERT VARIABLE X NAME","INSERT VARIABLE Y NAME"},FrameTrue]
counts=Normal[#[All,"INSERT VARIABLE X"]]&/@grouped;Histogram[Values[counts],ChartLegendsKeys[counts],PlotLabel"Histogram",FrameLabel{"INSERT VARIABLE NAME","Count"},FrameTrue,ChartStyleOpacity[0.5]]
lengths=Normal[#[All,"INSERT VARIABLE Y"]]&/@grouped;BoxWhiskerChart[lengths,ChartLabelsKeys[lengths],PlotLabel"Boxplot",FrameTrue]
[TEACHER-FACING]
Look closely: Each cell contains its own code for its own graph. This means that students can run each individually and decide which (if not all) they would like to have. Common errors will include typos in variable names (Bill_Depth is not the same as bill_depth), not placing the variable names within the doubles quotes, and simply altering any code that does not ask them to insert a variable. The rest of the code besides these portions should remain untouched. Below is some example code, assuming my research question is "Does antarctic penguin bill length differ by species?":
[TEACHER-FACING]
Look closely: Each cell contains its own code for its own graph. This means that students can run each individually and decide which (if not all) they would like to have. Common errors will include typos in variable names (Bill_Depth is not the same as bill_depth), not placing the variable names within the doubles quotes, and simply altering any code that does not ask them to insert a variable. The rest of the code besides these portions should remain untouched. Below is some example code, assuming my research question is "Does antarctic penguin bill length differ by species?":
ListPlot[Normal/@(#[All,{"bill_length","bill_length"}]&/@grouped),PlotLegendsKeys[grouped],PlotLabel"Scatterplot",FrameLabel{"Bill Length","Bill Length"},FrameTrue]
Out[]=
NOTICE! Because I only have one quantity variable (bill length), this graph doesn't work too well for our purposes, as it expects another quantity, not the same one (bill_length is included twice above). Some students may be confused at this point, and it could be helpful to simply direct them to try the other graphs and see where the differences are. Ultimately, this work is not about simply what we compute, but what we compute for. Students should begin to understand, at least intuitively, that certain visualizations will work for certain types of questions.
Students with two quantity variables should ultimately be using the first graph, with a possibility to understand each of the two variables separately using the second and third graph. Students with one quantity variable, like in the code above, should only be using graphs two and three to visualize their data. Below is the code for if a student were to use two quantity variables, perhaps to answer a research question like: "Can bill depth be used to predict bill length?"
Trends
Trends
What trends or patterns seem to appear in your data? What might these say about your research question? Do your findings make sense to you intuitively?
[TEACHER-FACING]
Answers here may vary, but it is OK if they are obvious. The point of a data visualization is for a viewer to be able to parse and interpret information quickly and easily. This activity can be facilitated via students sharing their trends with a peer. This also provides a "check" for students who may be misinterpreting the data.
Answers here may vary, but it is OK if they are obvious. The point of a data visualization is for a viewer to be able to parse and interpret information quickly and easily. This activity can be facilitated via students sharing their trends with a peer. This also provides a "check" for students who may be misinterpreting the data.
Results
Results
Now that we've got some visualizations for our data, it is time to use statistics to make empirical conclusions in regards to our research question.
Linear Regression: Can this predict that?
Linear Regression: Can this predict that?
If you are trying to understand if one variable (like bill length; my predictor) can predict another (like bill depth; my outcome), use the code and corresponding output below.
[TEACHER-FACING]
Students should only alter the first line of code here. The "predictor" is the variable that they would like to learn predicts the other variable, or "outcome". If I wanted to know if bill depth could predict bill length, then bill depth is my predictor and bill length is my outcome. Think: predictor = independent variable (x), outcome = dependent variable (y). Here is how the code should look and run with this example:
Students should only alter the first line of code here. The "predictor" is the variable that they would like to learn predicts the other variable, or "outcome". If I wanted to know if bill depth could predict bill length, then bill depth is my predictor and bill length is my outcome. Think: predictor = independent variable (x), outcome = dependent variable (y). Here is how the code should look and run with this example:
Please refer to the Technical Cheat-sheet for support in reading this table. By the time students are taking AP Research, they should have already taken a math course which covers line of best fit. The core concepts there, are the core concepts here.
Please refer to the Technical Cheat-sheet for support in reading this table. By the time students are taking AP Research, they should have already taken a math course which covers line of best fit. The core concepts there, are the core concepts here.
Analysis of Variance (ANOVA): Is there a difference between these groups of things?
Analysis of Variance (ANOVA): Is there a difference between these groups of things?
If you are trying to understand if 3 or more groups (species) of associations (penguins) are statistically different by some quantity (bill length, bill depth, etc), use the code and corresponding output below.
[TEACHER-FACING]
Students should only alter the first two lines. Their group variable is whichever they chose before if they did choose one ("island","species","year"). Their quantity variable is the actual measurement they are interested in. So if I wanted to learn more about how species differ by body mass (if at all), I could run the following code:
[TEACHER-FACING]
Students should only alter the first two lines. Their group variable is whichever they chose before if they did choose one ("island","species","year"). Their quantity variable is the actual measurement they are interested in. So if I wanted to learn more about how species differ by body mass (if at all), I could run the following code:
Please refer to the Technical Cheat-sheet for support in reading this table. Only students who have taken a high school statistics course, or a class with similar content, may be familiar with ANOVA. Focus only on the most essential metrics for answering the research question, and refrain from analyzing anything else too deeply. For instance, the p-value tells us how likely these differences in body mass across the species were to occur if by random chance. Focusing on the fact that our model computes an extremely tiny probability of 3.74450512630046*^-81, we can rest assured that there is indeed a significant difference between penguin species on the basis of body mass. For this analysis, I need not refer to the other statistics.
Conclusion
Conclusion
Discussion
Discussion
Given everything you have learned in this module, were you able to answer your research question? If you were able to, detail what empirical evidence you've collected that supports this claim(s).
If you were not able to adequately answer your research question, ask yourself: could I have answered my question using only the data provided? Was there something meaningful you learned about the topic regardless?
If you were not able to adequately answer your research question, ask yourself: could I have answered my question using only the data provided? Was there something meaningful you learned about the topic regardless?
Next Steps
Next Steps
How would you expand on the work of these researchers? Is there a different sample you would consider? A different research focus? Would you change how the research was conducted. Discuss this below.
[TEACHER-FACING]
For this activity, consider having students independently form their closing thoughts, as they should be culmination of the work they have done this module. Then, as responses to the Next Steps section may be scarce at first, invite small to large group discussion. This is where the module can conclude.
[TEACHER-FACING]
For this activity, consider having students independently form their closing thoughts, as they should be culmination of the work they have done this module. Then, as responses to the Next Steps section may be scarce at first, invite small to large group discussion. This is where the module can conclude.