Last active
January 22, 2023 16:27
-
-
Save kylebgorman/969b0fdedcd7c35858c5d4742934ff23 to your computer and use it in GitHub Desktop.
Tests the hypothesis that vigesimal (base-20) number systems are more common at tropical latitudes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env Rscript | |
# WALS131A.R | |
# Kyle Gorman <kylebgorman@gmail.com> | |
# | |
# Tests the hypothesis that vigesimal (base-20) number systems are more common | |
# at tropical latitudes. Thanks to Richard Sproat for suggesting this | |
# hypothesis. | |
# | |
# The data is read directly from WALS (#131A): | |
# | |
# Dryer, Matthew S. and Haspelmath, Martin (eds.). 2013. The World Atlas of | |
# Language Structure Online. Max Planck Institute for Evolutionary | |
# Anthropology. URL: http://wals.info. | |
URL <- "http://wals.info/feature/131A.tab" | |
SKIP <- 5 # First five rows are documentation. | |
d <- droplevels(subset(read.table(URL, sep="\t", header=TRUE, skip=SKIP), | |
value < 4)) | |
cat(sprintf("\nCounts:\n")) | |
print(table(d$description)) | |
# Our independent variable: absolute latitude. | |
d$absolute.latitude <- abs(d$latitude) | |
cat(sprintf("\nMedian absolute latitude:\n\n")) | |
print(with(d, tapply(absolute.latitude, description, median))) | |
# Simple models. | |
wt <- with(subset(d, value < 3), | |
suppressWarnings(wilcox.test(absolute.latitude ~ value))) | |
cat(sprintf("\n")) | |
cat(sprintf("Decimal vs. hybrid:\tW = %.1f,\tp = %.3f\n", | |
wt$statistic, wt$p.value)) | |
wt <- with(subset(d, value > 1), | |
suppressWarnings(wilcox.test(absolute.latitude ~ value))) | |
cat(sprintf("Hybrid vs. vigesimal:\tW = %.1f,\tp = %.3f\n", | |
wt$statistic, wt$p.value)) | |
wt <- with(d, suppressWarnings(wilcox.test(absolute.latitude ~ value < 2))) | |
cat(sprintf("Decimal vs. other:\tW = %.1f,\tp = %.3f\n", | |
wt$statistic, wt$p.value)) | |
wt <- with(d, suppressWarnings(wilcox.test(absolute.latitude ~ value < 3))) | |
cat(sprintf("Vigesimal vs. other:\tW = %.1f,\tp = %.3f\n", | |
wt$statistic, wt$p.value)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment