Homework 1: Sample Characteristics

Introduction

In this assignment you will start to work with Amy’s research data: Criminal Justice Personal Connections Survey. As part of this week’s assignment you will be familiarizing yourself with the survey tool and questions that were asked. The survey tool can be found in the Week 3 Google drive folder.

Your goal in this assignment is to describe the characteristics of students in this sample. How many people were surveyed? From what age ranges, nationalities and majors?

Most questions in this assignment require you to write code to answer a question, but don’t forget to write the answer in an English sentence also! Typically code is not an answer by itself.

When answering a question with data, your answer should consist of full English sentences with supporting numbers. A great example is the Frequency tables description in the 02-wwd code along.

Get the homework template and data.

You will do your work in a template quarto file provided for you either on the schedule or in RStudio/Jupyterhub in the shared/Wicked folder. You will need to copy hw01_template into your home directory, but do not need to rename this file.

The data set is called demog.csv and available in our Jupyterhub shared/Wicked/data folder. Do the following to copy the data to your home directory.

  1. Make a data folder in your home directory in R Studio by clicking “New Folder” in the Files tab, and naming this data (all lower case).
  2. Navigate to shared/Wicked/data, click the box next to demog.csv and “Copy To” - put this in your Home/data folder.

If you are working locally, export this data set and put it into a data subfolder in the class folder you are working on.

Submission instructions

Render your completed assignment to PDF. Make sure it looks good before you submit, and ask for help if you are unsure or running into errors. Submit to Canvas by the due date.

Follow the instructions below and answer the questions below to start to become familiar with the data.


Import

Run the code below into your file to load the necessary packages and data has been set up for you. If this does not successful load the data into your Environment, check that your data is in YOUR home/data folder. If you think you have it correct but it’s not working - post a screenshot in our class discussion board.

What variables do we have?

  1. Use glimpse() to inspect the variables in the demog data set. Match these variable names to the codebook, and write 1-2 “human readable” words that describe what this variable is about. The first three have been started for you
  • consent: Consent
  • Q1: Age
  • Q2: Race/Ethnicity
  1. Using the information from glimpse, how many rows (observations, people) do we have, and how many columns (variables/characteristics)

  2. Not everyone consented to participate in this research. Create a table() of the consent variable and report how many said “No”.

  1. Even if there is data on the individuals that said “no” they did not consent, it is not ethical to use those data rows. Use the tactics shown in 01-intro_r under Conditional subsetting to make a new data frame called demog_analysis that filters the demog data set to only keeps rows where consent != "No"

Sample Characteristics

Answer the following questions on the analysis data set (demog_analysis)

  1. How old are students in the analysis data set? Your answer should include both numbers and percents.

  2. What genders are represented? Create a plot then answer this question.

  3. Describing the racial/ethnic makeup of participants is challenging with the data as collected. Identify and describe why this is the case. Run at least one R command to demonstrate the difficulty. Hint: You will have to read the codebook carefully and think back to examples we saw in class on day 1.

  4. Pick one other variable to describe. Create a table, a proportion table, and a barplot of this variable. Describe some patterns you see using both N’s and %’s in your answer.

  5. Often we are interested in average gpa for groups of people. Is it possible to calculate the average GPA for students in this data set? Why or why not? You must justify your answer using the results from code or describe some feature about the data in your answer.

  6. Write one research question that we could try to answer with this data. Identify the specific variables that you would use.