This repository contains the R code used for computing all major results shown and discussed in the paper:
"Environmental factors drive language density more in food-producing than in hunter-gatherer populations" by Derungs et al. (currently in review)
In order to run the R code locally the following two folders are required:
-
Some of the R scripts read input data (e.g. language lists or environmental data). All required input data can be downloaded from this link. The downloaded input.rar has to be unpacked and stored in the same directory as the R code (there should now be a folder called "input/").
-
Results are stored in an "output/" folder. An output folder that contains all results from a previous execution of the code can be downloaded from this link. The downloaded output.rar has to be unpacked and stored in the same directory as the R code and the input folder.
This repo contains six R scripts with the following purpose:
- 001_regularGrid.R: Computes the regular grid for three spatial resolutions
- 002_langPrep.R: Prepares the language data such that it can be used in the follow up analysis
- 003_langAggreg.R: Generates language counts for the grid points from the input language information
- 004_random_NS.R: Simulates 500 random distributions of points, which result in the expected counts per regular grid point
- 005_addingPredictors.R: Retrieves environmental information for all grid points
- 006_prediction.R: Predicts LD peaks and troughs with environmental information, using Random Forest
- Curdin Derungs - Implementation, Analysis
- Balthasar Bickel - Research Design