library(tidyverse)
Homework 3
You can download a template file to start from here.
This work should be done individually meaning that each person should choose their own meter. Do not use the same meter as someone you are working with on this assignment. You can and should support each other in your work process but make sure that what you type (code and reflections/observations) in this document reflects your own words and ideas.
Submission:
- Submit your completed homework as a rendered Quarto document (html) to Moodle.
Macalester Energy Use
Go to Moodle HW 3 assignment and download the dataset, Macalester_Electricity_Use_2025.csv
.
This dataset, provided by the Sustainability Office, includes the electricity meter data on properties that Macalester College owns. Note there are three types of electricity meters: Electric - Grid, Electric - Solar, Electric - Wind. This data is originally recorded as a monthly usage with a start and end date. Brianna has done some initial cleaning to calculate the average usage per day to account for different month lengths. Below are the definitions of some of the variables in the dataset.
start_date
: The first date of the collection period end_date
: The last date of the collection period property_name
: The name of the property (26 unique property names) property_type
: Type of property (9 unique property types) meter_name
: The name of the meter (36 unique meter names) meter_type
: The type of the meter (3 unique meter types) gross_floor_are
: The square footage of area in the property days
: The number of days in the collection period street_address
: Address of the property use_per_day
: The average electricity usage per day within the collection period (calculated by taking total usage / days in collection period). max_temp_avg
: The average daily maximum temperature (in degrees Fahrenheit) during the collection period max_temp_typical
: The average daily maximum temperature (in degrees Fahrenheit) for the same period in a typical year max_temp_days_not_typical
: The number of days in the collection period where the maximum temperature deviated more than 5 degrees from the typical maximum temperature min_temp_avg
: The average daily minimum temperature (in degrees Fahrenheit) during the collection period min_temp_typical
: The average daily minimum temperature (in degrees Fahrenheit) for the same period in a typical year min_temp_days_not_typical
: The number of days in the collection period where the minimum temperature deviated more than 5 degrees from the typical minimum temperature
- Download the data. Put the file in a known location (the same folder that this qmd is in) on your computer. Look at the csv file and then read in the data into R.
- Choose one meter from the options with a non-constant trend and seasonality in the
use_per_day
; do not choose the “Chiller Plant”. Make sure you choose a meter with at least 100 observations (some meters are relatively new; it is harder to estimate a trend and seasonality).
Tell me what that Property Name and Meter Name you’ve chosen to work with. Visualize and explore a few meters before making a decision.
ANSWER:
- Come up with at least two estimates of the trend of the electricity usage. Plot both of those estimates as a function of time. Justify which estimate you prefer.
ANSWER:
- Plot the de-trended series (residuals = original outcome data - estimated trend). Comment on the de-trended series.
ANSWER:
- Estimate the seasonality of the de-trended series. Plot the average yearly cycle. Comment on the average cycle.
ANSWER:
- Plot the de-trended series after removing the yearly seasonality (so you are left with the errors). Comment on what you observe.
ANSWER:
- Estimate the autocorrelation of the errors (using
acf()
assuming stationarity) and comment on what you observe about the errors.
ANSWER:
- Predict the average daily meter usage based on the trend and seasonality for the next 5 months. We haven’t formally learned how to do this but think about how you might do this; be creative. You goal is to see if you can create a plot of the original data and add a red line that shows this prediction. Do your best.
ANSWER:
- Briefly reflect on what you’ve learned about Macalester’s energy usage and the questions you have about the data generation process.
ANSWER: