Math/CSCI 385 Exam 1: Take-Home Instructions

Published

October 14, 2026

Logistics

  • The take-home is worth 20 points.
  • Your repo will be distributed on GitHub on Wednesday, October 14 by 6am.
  • It is due Thursday, October 15 at 12:30pm, to GitHub only.
  • I will access the state of your repo at your last push before the deadline. Work that is not committed and pushed does not count.
  • I will render your .qmd file and grade what comes out. If it does not render -for ANY reason- you will get a 0 score for this portion of the exam.
  • Work on your own. AI tools are not allowed.
  • A grading rubric is provided at the bottom of this page.

Data

You will work with two data sets about California counties. The election data is in your repo. You load the census data from an R package. Details on the data sources is below.

County census data

The data set county_complete from the usdata package has one row for each of 3,142 US counties and 188 columns. The columns include population, age, race and ethnicity, education, income, poverty, employment, housing, and internet access. Many variable names end in a year, such as poverty_2019 or unemployment_rate_2012. Each county is identified by state, name, and fips (the county FIPS code). Run ?usdata::county_complete for a description of every variable.

usdata::county_complete

Presidential election results

The file data/countypres_ca_2008-2020.csv has county-level presidential election results for the 58 California counties in 2008, 2012, 2016, and 2020. Each row is one candidate in one county in one election year.

Variable Class in R Description Valid values
county_name character County name 58 California county names, in capital letters
year double Election year 2008, 2012, 2016, 2020
state_po character State postal abbreviation CA
county_fips double County FIPS code 6001 to 6115
office character Office being elected US PRESIDENT
candidate character Name of the candidate Names
party character Party of the candidate DEMOCRAT, REPUBLICAN, GREEN, LIBERTARIAN, OTHER
candidatevotes double Votes received by this candidate in this county 2 to 3,028,885
totalvotes double Total votes cast in this county in this year 602 to 4,264,365
version double Date the data was finalized 20260225

Data citations

  • MIT Election Data and Science Lab. (2018). County Presidential Election Returns 2000-2024 (Version V20) [Data set]. Harvard Dataverse. https://doi.org/10.7910/DVN/VOQCHQ. Released under a CC0 1.0 license. Filtered to California, 2008 to 2020.
  • Çetinkaya-Rundel, M., Diez, D., & Dorazio, L. (2024). usdata: Data on the States and Counties of the United States (R package version 0.3.1). https://doi.org/10.32614/CRAN.package.usdata. Per the package documentation, the county data comes from the US Census Bureau (including the American Community Survey), the USDA Economic Research Service, and the Bureau of Labor Statistics.

Your task

Explore the data to answer a research question of your choice. There is no step-by-step guidance. This is not a polished report for an executive. Think of it as a work log for a supervisor who wants to check your thinking. I am grading your reasoning more than your final result.

Start by stating your research question (one sentence) and the variables you think you will need. Choose a research question that you think you can answer, but not one that is overly simplistic. Then work in repeating steps. For each step:

  1. Observe: look at the data (a glimpse(), a count, a plot) and write what you notice.
  2. Decide: write what you will do about it and why. For example, “I see ___ , so I will ___ because ___.”
  3. Do: write the code.
  4. Explain what you learned: write 1 to 3 sentences on what the result shows and what it means for your next step.

Short sentences are fine. If something does not work, say what you tried and why you changed course. Keep only code that runs, because your document has to render.

Your work must include:

  • At least 3 different techniques from the table below, each labeled in your code with a comment such as # Technique: join.
  • At least 2 plots and 1 table of summary statistics. These are expected in every report, so they do not count as techniques.
  • A final 1 to 2 sentence answer to your research question, based on your evidence.

Use only what you need to answer your question. You do not earn more points for using more than 3 techniques, and you do not need to find any particular answer. A well justified “I found no relationship” can earn full credit.

Techniques

The functions below are examples to help you understand what I mean by a “technique”. It is not a complete list and you should consider other functions that reasonably fit in that topic. Any other technique we covered in weeks 1 to 6 counts.

Technique Examples
Import and clean parse_number(), as.numeric(), clean_names(), col_types, handling NAs, dates with ymd()
Wrangle filter(), select(), arrange(), mutate(), group_by() with summarise(), count()
Recode case_when(), if_else()
Factors fct_relevel(), fct_rev(), fct_reorder()
Join left_join(), inner_join(), anti_join()
Reshape pivot_longer(), pivot_wider()

Format

  • Create one Quarto document, 3 to 5 pages long with appropriate YAML header title, author, date. No template is provided
  • Hide all warnings and messages by adding appropriate execution options to your YAML header. Keep your code showing.
  • Control your figure sizes with fig-width and fig-height so your plots are readable and fit the page.
  • Commit and push your final version to GitHub before the deadline.

Grading

Each row is scored as full points, partial points, or no points. A document that does not render earns 0 for the whole take-home.

Criterion Full points Partial points No points
Research question and variables (2 pts) One clear sentence that this data can answer, with the variables you plan to use named. The question is stated but vague or hard to answer with this data, or the opposite: a too simplistic question was posed, or the variables are missing No research question.
Decisions documented (6 pts) At each step you say what you observed, what you decided, and why. Your reasons point to something you saw in the data. Some decisions are explained, or reasons are given without pointing to anything you observed. Code appears with little or no explanation of what you did or why.
Techniques (4 pts) At least 3 different techniques, each labeled, used correctly, and needed to answer your question. Fewer than 3 labeled techniques, or some are used incorrectly or are not needed. No labeled techniques, or the code does not run.
What you learned (5 pts) Each plot, table, and result is interpreted with specific numbers or patterns, and you say how it shaped your next step. Results are described, but the interpretation is vague, has no evidence, or is not connected to your next step. Results are shown with little or no interpretation.
Conclusion (2 pts) A 1 to 2 sentence answer that directly answers your question using your evidence. An answer is given but is not supported by your results. No answer.
Readability (1 pt) 3 to 5 pages, with readable code and figures. Outside the page limit, or figures are hard to read.