Skip to content

Commit

Permalink
add in culture data
Browse files Browse the repository at this point in the history
  • Loading branch information
LucyMcGowan committed Jun 2, 2022
1 parent ef7e373 commit 544cf88
Show file tree
Hide file tree
Showing 14 changed files with 52 additions and 11 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
Package: pald
Title: Partitioned Local Depths for Community Structure in Data
Title: Partitioned Local Depth for Community Structure in Data
Version: 0.0.2
Authors@R:
c(person("Katherine", "Moore", email = "[email protected]", role = c("aut"),
comment = c(ORCID = "0000-0001-6943-2416")),
person("Kenneth", "Berenhaut", email = "[email protected]", role = c("aut")),
person("Lucy", "D'Agostino McGowan", email = "[email protected]",
role = c("aut", "cre"), comment = c(ORCID = "0000-0001-7297-9359")))
Description: Implementation of the Partitioned Local Depths (PaLD)
Description: Implementation of the Partitioned Local Depth (PaLD)
approach which provides a measure of local depth and the cohesion of a point
to another which (together with a universal threshold for distinguishing
strong and weak ties) may be used to reveal local and global structure in
Expand Down
5 changes: 3 additions & 2 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# pald 0.0.1
# pald 0.0.2

* Allow non-symmetric matrices to be input
* Allow non-symmetric matrices to be input
* Add `cultures` data

# pald 0.0.1

Expand Down
15 changes: 15 additions & 0 deletions R/cultures.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#' Cultures pairwise dissimilarities
#'
#' Pairwise dissimilarities are given by the cultural fixation index obtained
#' from World Values Survey responses.
#'
#' @references M. Muthukrishna, et al., Beyond western, educated, industrial,
#' rich, and democratic (WEIRD) psychology: measuring and mapping scales of
#' cultural and psychological distance. Psychol. Sci. 1, 24 (2020).
#'
#'R. Inglehart et al, World Values Survey: All Rounds-Country-Pooled Datafile
#' 1981-2014, (JD Systems Institute, Madrid 2014).
#'
#' @format A `59x59 matrix` of dissimilarities
#'
"cultures"
2 changes: 1 addition & 1 deletion R/pald_functions.R
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,7 @@ community_clusters <- function(c) {
cluster = cl
)
}
#' Partitioned Local Depths (PaLD)
#' Partitioned Local Depth (PaLD)
#'
#' A wrapper function which computes the cohesion matrix, local depths,
#' community graphs and provides a plot of the community graphs with connected
Expand Down
4 changes: 2 additions & 2 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ knitr::opts_chunk$set(
[![R-CMD-check](https://github.com/LucyMcGowan/pald/actions/workflows/check-standard.yaml/badge.svg)](https://github.com/LucyMcGowan/pald/actions/workflows/check-standard.yaml)
<!-- badges: end -->

This package provides an implementation of the Partitioned Local Depths (PaLD) approach which consists of a measure of *local depth* and the *cohesion* of a point to another which, together with a universal threshold for distinguishing strong and weak ties, may be used to reveal local and global structure in data. No extraneous inputs, distributional assumptions, iterative procedures nor optimization criteria are employed. This package includes functions for computing local depths and cohesion matrices as well as flexible functions for plotting community networks and displays of cohesion against distance.
This package provides an implementation of the Partitioned Local Depth (PaLD) approach which consists of a measure of *local depth* and the *cohesion* of a point to another which, together with a universal threshold for distinguishing strong and weak ties, may be used to reveal local and global structure in data. No extraneous inputs, distributional assumptions, iterative procedures nor optimization criteria are employed. This package includes functions for computing local depths and cohesion matrices as well as flexible functions for plotting community networks and displays of cohesion against distance.

For further discussion of the perspective, including some theoretical results and applications, see:

Expand Down Expand Up @@ -52,7 +52,7 @@ library(pald)

## Input

The input for the Partitioned Local Depths (PaLD) approach is a distance matrix (or `dist` object) associated with a finite collection of data points. Throughout, no distributional assumptions, iterative procedures nor optimization criteria are employed.
The input for the Partitioned Local Depth (PaLD) approach is a distance matrix (or `dist` object) associated with a finite collection of data points. Throughout, no distributional assumptions, iterative procedures nor optimization criteria are employed.

The only information extracted from the distance matrix are within-triplet dissimilarity comparisons. As a result, outputs are unaffected by monotone transformations of the collection of distances (e.g., $\log_2$). Further, one may transform any measure of similarity, $s(x, y)$, to a measure of dissimilarity, $d(x,y)$, via any order-reversing monotone transformation, for instance by taking $d(x, y) = 1/(1 + s(x, y))$. This provides the user some flexibility in the choice of dissimilarity (e.g., triangle inequality is not required) and care should be taken at this stage.

Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ January 2022
[![R-CMD-check](https://github.com/LucyMcGowan/pald/actions/workflows/check-standard.yaml/badge.svg)](https://github.com/LucyMcGowan/pald/actions/workflows/check-standard.yaml)
<!-- badges: end -->

This package provides an implementation of the Partitioned Local Depths
This package provides an implementation of the Partitioned Local Depth
(PaLD) approach which consists of a measure of *local depth* and the
*cohesion* of a point to another which, together with a universal
threshold for distinguishing strong and weak ties, may be used to reveal
Expand Down Expand Up @@ -47,7 +47,7 @@ library(pald)

## Input

The input for the Partitioned Local Depths (PaLD) approach is a distance
The input for the Partitioned Local Depth (PaLD) approach is a distance
matrix (or `dist` object) associated with a finite collection of data
points. Throughout, no distributional assumptions, iterative procedures
nor optimization criteria are employed.
Expand Down Expand Up @@ -390,7 +390,7 @@ cohesion) and can be found directly from the cohesion matrix.
library(igraph)
G_strong_lang <- community_graphs(C_lang)$G_strong
neighbors(G_strong_lang, "French")
#> + 8/87 vertices, named, from a44fbe8:
#> + 8/87 vertices, named, from c8a0516:
#> [1] Italian Ladin Provencal Walloon
#> [5] French_Creole_C French_Creole_D Spanish Catalan

Expand Down
Binary file added data/cultures.rda
Binary file not shown.
25 changes: 25 additions & 0 deletions man/cultures.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified man/figures/README-comm-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified man/figures/README-k-mean-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified man/figures/README-lang-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified man/figures/README-pald-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified man/figures/README-rand-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion man/pald.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 544cf88

Please sign in to comment.