Coder Social home page Coder Social logo

poverty-and-education's Introduction

poverty-and-education

It is often said that education offers a path out of poverty and allows one to climb up the economic ladder. In this rudimentary analysis, we examine if education rates and poverty rates are linked.

The study examines data that the US government [1] has made available. The economic research service branch of the US Department of agriculture has conveniently made available economic and education data at the county level.

The hypothesis is that education and poverty are negatively correlated. The pairwise relationship between the education rates and poverty rates can be quantified by the correlation and their dependence or lack of can be shown on a scatter plot.

This report shows that the simple assumption of a linear relationship is insufficient to describe the observations. However, a trend is that poverty rates are lower for counties whose populations have attained college degrees at higher rates, thus reinforcing the belief that education is a path out of poverty.

Dependencies

Make

This project requires several programs and packages to be installed. Dependencies can be easily checked by opening a command line and changing directory such that the command

pwd

gives

the/path/to/poverty-and-education

The project requires make to build which can be checked by typing

make --version

If a version number is returned, the remaining dependencies can be checked with

make check

which lists the dependencies and whether they are accessible.

Packrat

The project can also be built from within Rstudio by opening the poverty-and-education.Rproj file at the project root directory. packrat should install the missing R packages if they are missing. If packrat is missing, it can install itself. One can navigate to the Rstudio console and run the make commands from there (see "Dependencies: Make" and "Generating the report").

Docker

A docker image container that contains the required packages and utilities can be pulled by the name sastrill/poverty-and-education with a Docker program. For security reasons, the project itself is not on the docker image. Thus, it must be "linked" from a folder on your computer to the "ephemeral" container. The code below performs the link and the build process. No make check is necessary since the Docker image was designed with all the necessary dependencies.

docker run -it --rm -v "/c/path/to/poverty-and-education":/home/poverty-and-education sastrill/poverty-and-education make all -C /home/poverty-and-education

Note: Users should take note to surround first path with quotes (double quotes specifically) if the path contains a space. The root directory for Windows users in git bash form is /c/ instead of C:\.

Once built, the final report resides in doc/report.md.

Generating the report

The diagram below illustrates the dependency tree.

Makefile.png

The data is in the form of two excel files:

which are downloaded using the script src/get-data.sh. To download the files to the correct directory, run

bash src/get-data.sh https://www.ers.usda.gov/webdocs/DataFiles/48747/Education.xls?v=42762 data/education.xls
bash src/get-data.sh https://www.ers.usda.gov/webdocs/DataFiles/48747/PovertyEstimates.xls?v=42762 data/poverty.xls

Specific data from these two files will be wrangled together using an Rscript. The cleaned data set is saved in results/socioeconomic.csv by running

Rscript src/wrangle.R data/poverty.xls data/education.xls results/socioeconomic.csv

A scatterplot is generated from this data using another Rscript by calling

Rscript src/analyze.R results/socioeconomic.csv results/scatter-relation.png

which generates the figure results/scatter-relation.png.

Finally, the report uses this figure. To generate the report,

Rscript -e 'ezknitr::ezknit(\"src/report.Rmd\", out_dir=\"doc\", keep_html = FALSE)'

The final report will be available in doc/report.md.

Sources

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.