J Lab 1
Data Manipulation and Display
Portions of this lab use data provided with the Introduction to Modern Statistics (2e) textbook by Mine Çetinkaya-Rundel and Johanna Hardin.
Part 1: Guided Walkthrough
In the guided walkthrough you will learn how to import data, set up variable types, filter, recode variables, explore categorical variables, create frequency tables, bar plots and stacked bar plots, explore numerical variables, create numerical variable tables and create histograms and box plots. You will use these skills in Part 2 to answer questions that you will turn in for your lab report.
Note: The questions in Part 1 are for your own understanding and do not need to be included in your lab report. Only the questions in Part 2 need to be turned in.
Section 1: Introduction & Import CSV
In this lab you will explore the birds data set, available here or on our Moodle page. The data set is a collection of all collisions between aircraft and wildlife (almost always birds) that were reported to the US Federal Aviation Administration between 1990 and 1997, with details on the circumstances of the collision.
Download the birds.csv file to your computer. Then, open it in Jamovi by clicking on the hamburger menu (the three horizontal lines in the top left corner) and selecting Open. Click the Browse button and navigate to the file you downloaded.
How many cases/observations are there? What does each row represent?
Section 2: Set Up Variable Types
You will only use a subset of the variables for this lab, described in the following table. In Jamovi, click on the Data tab, then click on the Setup icon. Set up the Measure type and Data type for each variable as shown in the table. You can select different columns by clicking on the column names at the top of the spreadsheet.
| Variable | Measure type | Data type | Description |
|---|---|---|---|
phase_of_flt |
Nominal | Text | Phase of the flight during which the collision occurred: Approach, Climb, Descent, etc. |
time_of_day |
Nominal | Text | Light conditions: Dawn, Day, Dusk, Night. |
height |
Continuous | Integer | Feet above ground level at time of collision |
effect |
Nominal | Text | Effect on flight: Aborted Take-off, Engine Shut Down, None, Other, Precautionary Landing. |
Section 3: Filtering Data
In this section you will focus on the variables effect and phase_of_flt. Effect is the response of the aircraft pilots to the collision. Phase_of_flt is the phase of the flight when the collision occurred: Approach, Climb, Descent, En Route, Landing Roll, depend on which phase of flight the collision occurs?
To explore these variables open the Analyses tab and select the Exploration module and select “Descriptives” from the menu. Select the variables phase_of_flt and effect for the “Variables”.
How many observations have the phase_of_flt recorded and how many are missing? And how many are recorded and missing from effect?
You will apply a filter to the data to the effect variable to eliminate collisions where there was no effect on the flight. To set up this filter, click on the Data tab in Jamovi, then click on the Filters icon. Type effect != "None" in the “Filter 1” box to eliminate collisions where there was no effect on the flight. Activate this filter.
After the filter is active, click on the eye icon near the bottom left of the Jamovi window to hide the filtered (grayed out) rows. This makes it easier to scroll through just the retained cases.
Figure 1 shows the Filter interface in Jamovi with the filter to eliminate collisions with no effect.
Scroll through your filtered data set and confirm that the correct cases have been retained. You can calculate the number of remaining (non-filtered) cases by subtracting the number of Filtered rows from the Row count. These numbers are listed below the spreadsheet. Check: there should be 1,942 observations remaining.
Section 4: Recode/Transform a Variable
Now you will create a new variable called airborne that has a value of “yes” if the airplane was airborne when the collision with the bird occurred, and a value of “no” otherwise.
To create this variable:
Click on the Data tab.
Click on the header of the
phase_of_flightcolumn so it is selected.Click the Transform icon.
Change the name of the transformed variable to
airborne(by default it will be something likephase_of_flight (2)).In the pull-down box labeled using transform, select “create new transform”.
In the text field labeled \(f_x\), type the following recode condition:
IF ($source == “Approach” or $source == “Climb” or $source == “Descent” or $source == “En Route”, “Yes”, “No”)
In this formula,
$sourcerefers to the original variable (phase_of_flight). TheIFfunction checks whether the value equals eitherApproach,Climb,DescentorEn Route. If it does, the new variable gets the value “Yes”; otherwise it gets “No”.
Figure 2 shows the transformation interface with the correct recode condition.
Confirm that the new variable airborne has been created correctly by scrolling through your data set. Compare its values to the original phase_of_flight variable to make sure the recoding was done correctly.
Section 5: Frequency Table & Bar Plot for a Categorical Variable
What are the proportions of aircraft-bird collisions that happened on the ground and resulted an aborted take off and that happened while airborne and resulted in a precautionary landing. 1. Click on the Analyses tab, then click on the Exploration icon, and select Descriptives. 2. Drag the airborne variable into the Variables box and the effect variable into the Split By box. 3. Expand the Statistics options menu. Uncheck all of the numeric statistics (N, Mean, Median, Std. deviation, Minimum, Maximum) since they are not appropriate for a categorical variable. Then, check the box for Frequency tables (located below the Split by box). 4. Expand the Plots options menu and check the box for Bar plot.
Your results should be similar to the following:
Figure 3 shows tables of aircraft-bird collision effects and the frequency of these effects when the aircraft was airborne or on the ground during the collision.
Figure 4 shows a barplot of aircraft-bird collision effects and whether the aircraft was airborne or on the ground during the collision.
What proportion of these collisions happened on the ground and resulted in an aborted takeoff? What proportion happened while the aircraft was airborne and resulted in a precautionary landing? Which of these two situations happens more often?
Section 6: Tables, Histograms and Bar Plots for a Numerical Variable
We’ll investigate the question “How fast are aircraft typically going when they collide with birds?” The speed of the aircraft is given in knots (nautical miles per hour). We’ll look at the speeds both for airborne collisions and those on the ground.
First, filter the speed variable:
- Click on the Data tab and then the Filters icon. Leave first three filters active.
- Add a new filter to remove cases where
speedis missing:speed != NA. Make sure it is active.
Check: there should be 1,254 observations remaining.
Now create a table with the speed variable split by the airborne variable you created:
- Click on the Analyses tab, then click on the Exploration icon, and select Descriptives.
- Drag the
speedvariable into the Variables box and theairbornevariable into the Split By box. - Expand the Plots options menu and check the boxes for Histogram and Boxplot.
Your results should be similar to the following:
Figure 5 shows a table of aircraft speed statistics during aircraft-bird collisions and whether the aircraft was airborne or on the ground during the collision.
Figure 6 shows histograms of aircraft speed in knots during aircraft-bird collisions for collisions for airborne aircraft or aircraft on the ground.
Figure 7 shows boxplots of aircraft speed in knots during aircraft-bird collisions for collisions for airborne aircraft or aircraft on the ground including mean speed as a square black box.
Section 7: Taking Screenshots for Lab Reports
When creating your lab report, you will need to include screenshots of Jamovi tables and plots. The right-click copy method in Jamovi is sometimes unreliable, so it is better to take screenshots directly.
Mac: Press Command + Shift + 4, then drag to select the area you want to capture. The screenshot will be saved to your Desktop.
Windows: Press Windows + Shift + S to open the Snipping Tool. Drag to select the area you want to capture. The screenshot will be copied to your clipboard and can be pasted directly into your document.
Tips:
- Crop your screenshots tightly around the relevant table or plot.
- Position each screenshot directly under the question it corresponds to in your lab report.
Section 8: Saving Your Work
You can save your work in Jamovi by clicking on the hamburger menu and selecting Save. Save your work as a .omv file, which can be reopened in Jamovi later.
Important: The .omv file is not what you submit. You will submit a PDF of your lab report (see Part 2). However, you should save the .omv file in case you need to refer back to your work. If you are working on a classroom computer, email the file to yourself or save it to Google Drive before you leave.
Part 2: What You Need to Turn In
As you work through the questions below, build your lab report in a Word document or Google Doc. For each question, include the requested screenshots, tables, and written answers. You should write your report as you go rather than waiting until the end. See the [Submission Instructions] at the end of this document for more details.
You will work with the F26 Statistics Student Survey data set (f26_responses.csv), and you will focus on variables related to artificial intelligence use: top_chatbot , ai_submit, and ai_prompts_7d. The variable top_chatbot records which chatbot each student was most likely to use if any. ai_submit records whether the student has submitted an assignment that was assisted by AI and ai_prompts_7d records how many AI prompts the student has written in the past 7 days.
Scenario: We want to explore whether the top chatbot a student uses, if they use one, affects whether or not they’ve submitted an assignment assisted by AI and how many prompts they write each week.
Before starting, you may want to save a Jamovi file capturing your work on the walk through in Part 1 by selecting the hamburger menu and selecting “Save As” and giving the Jamovi file a name you can remember. Then download from Moodle and open the file f26_responses.csv for Part 2.
Question 1: Filter, recode, frequency table & bar plot for the ai_submit categorical variable.
Is stat student’s use of ChatGPT, if they use a chatbot, associated with whether or not they have submitted an assignment assisted by AI from the ai_submit variable.
- Create filters to retain only observations with responses for
top_chatbot,ai_submitandai_prompts_7dwith these three filters “top_chatbot != NA”`, “ai_submit != NA” and “ai_prompts_7d != NA” . Activate these filters. - Check: you should have 272 observations remaining.
- Create a new variable called
ChatGPT?by transforming thetop_chatbotvariable. Use the recode condition:IF($source == "ChatGPT", "Yes", IF($source == "I have not used a chatbot in the past month", "No", "Other")). This creates a variable indicating whether the observed stats student used ChatGPT (Yes), didn’t use chatbots (No) or used a different chatbot (Other). - Use the Descriptives analysis to create a frequency table and bar plot for the
ChatGPT?variable split by theai_submitvariable. Uncheck all numeric statistics and check Frequency tables. Check Bar plot under Plots.
In your lab report, include:
- A screenshot of the frequency table.
- A screenshot of the bar plot.
- The proportion of stats students submitted an assignment assisted by AI.
- The total number of stats students (N) in the filtered data.
- Looking at the Bar Plot, which
ChatGPT?variable group was more likely to have submitted an assignment assisted by AI than not: “Yes”, “No” or “Other”?
Question 2: Tables, Histograms and Bar Plots for a Numerical Variable
Is how many chatbot prompts a stat student submits over a 7 day period associated with whether a stat student uses ChatGPT, another chatbot or does not use one at all?
Use the Descriptives analysis to create a numerical table for the
ai_prompts_7dvariable split by theChatGPT?variable.Check Histogram and Box Plota under Plots.
In your lab report, include:
- A screenshot of the numerical table.
- A screenshot of the histograms and the box plots.
- Which group in the
ChatGPT?variable has the largest mean number of AI prompts over 7 days: “Yes”, “No” or “Other”? What is the mean for this group? - Which group in the
ChatGPT?variable has the largest maximum value? What is this maximum value> - Is the histogram of ai_prompts_7d for those who use ChatGPT, symmetric, skewed left or skewed right? Explain how you determined your answer.
- Jamovi shows outliers in the boxplots as dots. Is there any
ChatGPT?group that doesn’t have outliers? If so, which one(s)?
Create your lab report in a Word document or Google Doc. Organize your report as numbered answers (1 through 2) to the questions above. Include screenshots and plots positioned under the correct question number. Your answers should refer to the relevant plots or tables when applicable.
Save your report as a PDF and submit it using the appropriate submission link on the course Moodle page. Check the PDF before you submit it to make sure it is readable and complete.