Project 2: R Modeling and Validation

Use R to transform, visualize, model, and validate richer data for the assigned synthetic building.
NoteSubmission format

Submit a PDF report, an R source file, a required results CSV, and validation predictions. No Quarto or HTML document is required.

Purpose

Project 2 returns to the building-energy problem using R and a richer dataset. Students move from the numerical relationship studied in MATLAB to a statistical analysis that includes additional operating conditions.

The training and validation data remain group-specific. The validation file is withheld until the group has recorded its model plan.

Files Provided

Each team receives:

group-01-r-training.csv
project2-starter.R
project2-report-template.docx
data-dictionary.pdf

After the model plan is frozen, the team receives:

group-01-r-validation.csv

The training data may contain variables such as outdoor temperature, occupancy, wind speed, weekday/weekend status, and heating energy.

Required R Work

1. Import and check the data

  • Import the assigned training CSV.
  • Check variable types, missing values, duplicates, ranges, and categories.
  • Apply required corrections through code rather than silently editing the CSV.

2. Transform and summarize

  • Use the data-transformation tools taught in class.
  • Produce grouped numerical summaries.
  • Verify row counts after important transformations.

3. Visualize

Create appropriate plots for distributions and relationships. Figures must have clear labels, units, captions, and interpretations.

4. Freeze a model plan

Before receiving the validation data, record:

  • the numeric response;
  • the selected predictors;
  • the model formula;
  • the principal quantity to interpret;
  • a simple baseline prediction;
  • the validation metric;
  • one expected failure condition.

5. Fit and diagnose the model

  • Fit the planned model using only training data.
  • Interpret important coefficients in context.
  • Examine residuals and influential observations.
  • Compare training performance with the baseline.
  • State which assumptions matter for the conclusion.

6. Validate on new data

After the validation file is released:

  • apply the frozen model without redesigning it around the new outcomes;
  • save one prediction for every validation row;
  • calculate MAE, RMSE, or another approved metric;
  • compare training, baseline, and validation performance;
  • investigate where predictions fail.

7. Perform a sensitivity check

Repeat the analysis after one consequential change, such as removing an influential observation, excluding a condition, or changing a defensible modeling choice. Explain whether the conclusion survives.

Required Submission

group-01-project-2.pdf
group-01-project2.R
group-01-project2-results.csv
group-01-validation-predictions.csv

The R script must run from beginning to end with the assigned training and validation datasets. It must produce the figures, results, and predictions used in the PDF.

PDF Report

Use the supplied Word or Google Docs template and export the completed report as PDF. The report should normally contain:

  1. refined question and data description;
  2. data checks and transformations;
  3. exploratory figures;
  4. frozen model plan;
  5. fitted model and diagnostic checks;
  6. validation results;
  7. sensitivity analysis;
  8. conclusion and limitations;
  9. AI-use appendix.

Machine-Readable Results

The starter R script generates the results and prediction CSV files. These files allow the instructor to verify:

  • row counts and cleaning decisions;
  • the model formula and selected coefficients;
  • training, baseline, and validation errors;
  • one-to-one alignment of predictions with validation rows;
  • the reported sensitivity result.

Possible Project Verification

The R project is assessed as group work. Any student may nevertheless be selected for a brief verification, either randomly or because the submitted work requires clarification. The student may be asked to explain an R code fragment, interpret a figure or model result, describe a contribution, or reproduce a small modification. Selection is not itself an accusation of misconduct and has no separate routine grade weight.

Draft Grading Structure

Criterion Weight
Data transformation, summaries, and figures 25%
Model correctness and interpretation 25%
Diagnostics, validation, and sensitivity 30%
Reproducibility and machine-readable outputs 20%

Final Checklist

  • Does the R script run without manual intervention?
  • Are all transformations performed through code?
  • Are plots correctly labeled and interpreted?
  • Was the model plan recorded before validation outcomes were examined?
  • Does the prediction file contain exactly one row per validation observation?
  • Are error metrics independently reproducible?
  • Does the PDF agree with the R output and CSV files?
  • Is material AI assistance documented and checked?