Skip to content

2messmer/CarData-Analysis-R

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 

Repository files navigation


# CarData Analysis — Socioeconomic Study of Minneapolis Neighborhoods

## A Complete Statistical Workflow in R


## 1. Project Context

This project was conducted as part of a university-level statistical group assignment.

The objective was not only to perform descriptive analysis, but to design a **reproducible, structured, and auditable statistical workflow**.

The dataset used is MplsDemo from the carData R package, which contains demographic and socioeconomic information about neighborhoods in Minneapolis (2015).

The project emphasizes:

* Reproducibility

* Data integrity verification

* Structured exploratory analysis

* Statistical modeling

* Diagnostic validation

* Sensitivity analysis

This repository reflects a complete analytical pipeline rather than isolated code fragments.


## 2. Research Objective

The central research question of the project is:

Which socioeconomic and demographic variables are associated with median household income (hhIncome) across Minneapolis neighborhoods?

More specifically, we investigate:

* The relationship between poverty rate and income

* The effect of educational attainment (college graduates)

* The role of demographic composition (race, foreign-born population)

* The influence of population size

* The robustness of regression models


## 3. Dataset Description

The MplsDemo dataset includes neighborhood-level variables such as:

* hhIncome — Median household income

* poverty — Proportion of households below poverty line

* collegeGrad — Proportion of college graduates

* foreignBorn — Proportion of foreign-born residents

* black, white — Demographic composition

* population — Total population

* neighborhood — Neighborhood name

The dataset provides both numeric and proportion variables.


## 4. Analytical Workflow

The project follows a rigorous multi-stage statistical workflow.

### 4.1 Data Audit & Quality Control

Before any analysis, the script performs:

* Structure inspection (str())

* Dimension verification

* Missing value detection

* Duplicate detection

* Range validation

* Proportion bounds check (ensuring values in [0,1])

An audit report is automatically generated in:

outputs/MplsDemo_data_audit.txt

This ensures transparency and reproducibility.


### 4.2 Exploratory Data Analysis (EDA)

The EDA stage includes:

* Descriptive statistics (mean, sd, quartiles, min, max)

* Correlation matrix

* Histograms (for each numeric variable)

* Boxplots for outlier detection

* Scatterplots with regression lines

* Heatmap of correlations

* Top 10 neighborhoods by income and poverty

* Weighted demographic composition pie charts

* Quartile-based poverty segmentation

All figures are automatically exported to:

outputs/figures/

All tables are exported to:

outputs/tables/

This structured export keeps the console clean and improves grading readability.


### 4.3 Statistical Modeling

The modeling stage investigates relationships with hhIncome.

#### Simple Linear Models

Independent regressions of income on:

* College graduation rate

* Poverty rate

* Foreign-born proportion

* Black population proportion

#### Multiple Linear Regression

A full model including:

hhIncome ~ collegeGrad + poverty + foreignBorn + black

Key outputs:

* R² and Adjusted R²

* AIC

* RMSE

* Coefficient tables

* Significance tests

#### Log-Transformed Model

To test robustness, a log-transformed dependent variable model is estimated:

log10(hhIncome)

Model comparison metrics are saved in:

outputs/tables/09_model_metrics.csv


### 4.4 Diagnostics and Robustness Checks

This project goes beyond simple regression.

The following diagnostics are implemented:

* Residual analysis

* Cook’s distance

* Influential observation detection

* Variance Inflation Factor (manual VIF computation)

* Sensitivity analysis (removing influential neighborhoods)

* Comparison of coefficient stability

These steps ensure that conclusions are not driven by outliers or multicollinearity.


## 5. Key Findings

The analysis suggests:

* Education level (college graduation rate) is strongly positively associated with median income.

* Poverty rate has a strong negative association with income.

* Some demographic variables contribute additional explanatory power.

* Model diagnostics confirm reasonable stability after sensitivity checks.

Detailed numerical results are available in the exported tables.


## 6. Reproducibility & Automation

This script was designed to:

* Run from a clean session

* Automatically create output folders

* Automatically export figures and tables

* Generate a final summary file

* Ensure reproducible results using set.seed()

All results are reproducible by running the script once.


## 7. Project Structure

CarData-Analysis-R/

├── scripts/ # Main R script

├── data/ # Optional data storage

├── figures/ # Generated figures

├── outputs/

│ ├── figures/

│ └── tables/

├── rapport/ # Written academic report

└── README.md


## 8. How to Run

1. Install R

2. Install required package:

install.packages("carData")

3. Run the script in RStudio or R console.

All outputs will be automatically generated.


## 9. Skills Demonstrated

This project demonstrates:

* Structured statistical thinking

* Data validation procedures

* Regression modeling

* Diagnostic testing

* Sensitivity analysis

* Automated export workflow

* Reproducible research design

* Clear project organization


## 10. Academic Note

This project was completed as part of a university statistical group assignment.

The goal was to demonstrate methodological rigor rather than advanced machine learning.


## Author

NGUEDJIO Demessmer

Engineering Student — Computer Science


About

Complete statistical analysis of the MplsDemo dataset using R (EDA, regression, diagnostics, sensitivity analysis)

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages