• Aucun résultat trouvé

The Rsocialdata.network extension: Handling and analysing egocentric network survey data in R - beta release

N/A
N/A
Protected

Academic year: 2022

Partager "The Rsocialdata.network extension: Handling and analysing egocentric network survey data in R - beta release"

Copied!
40
0
0

Texte intégral

(1)

Conference Presentation

Reference

The Rsocialdata.network extension: Handling and analysing egocentric network survey data in R - beta release

ROUSSEAUX, Emmanuel, RITSCHARD, Gilbert

ROUSSEAUX, Emmanuel, RITSCHARD, Gilbert. The Rsocialdata.network extension: Handling and analysing egocentric network survey data in R - beta release. In: 4èmes Rencontres R , Grenoble, France, 24-26th June 2015, 2015

Available at:

http://archive-ouverte.unige.ch/unige:121252

Disclaimer: layout of this document may differ from the published version.

(2)

Introduction Overview of the package Demonstration What’s next

Rencontres R 2015

June 24-26, 2015 – Grenoble, France

The Rsocialdata.network extension: handling and analysing egocentric network survey data in R

beta release

Emmanuel Rousseaux Gilbert Ritschard

Institute of Demography and Socioeconomics Institute of Demography and Socioeconomics Institute of Information Service Science

[email protected] [email protected]

(3)

Introduction Overview of the package Demonstration What’s next

Outline

Introduction

Overview of the package Demonstration

What’s next

(4)

Introduction Overview of the package Demonstration What’s next

The Rsocialdata project

Key points:

I Storing survey data in R

(missing values, weighting, etc.) I Documenting data:

questions, values, variables, and surveys

I Saving time when preparing data to focus

quickly on analyses

(5)

Introduction Overview of the package Demonstration What’s next

Motivation for a network survey data extension

I Specific needs of survey data not fulfilled by other network packages

data description, missing, values, etc.

I Storing network data in a tabular way implies a lot of work to prepare data

Geneva VLV database: (5 × 5) × 4 + 5 × 8 = 100 + 40 = 140 variables for

(6)

Introduction Overview of the package Demonstration What’s next

Motivation for a network survey data extension

I Storing network data covariates makes preparing data even more tough

and increases the risk of making mistakes

I This data preparation work limits the reproducibility of results

multiple ways to proceed ⇒ make R codes difficult to share

(7)

Introduction Overview of the package Demonstration What’s next

Literature review

About 100 packages about ’networks’ available on the CRAN.

I networks:

classes for representing relational data types and supports arbitrary vertex/edge/graph attributes

I sna:

data structures, statistical tools, 2D/3D visualization

I d3Network:

(8)

Introduction Overview of the package Demonstration What’s next

Literature review

I egonet:

small tool dealing with ego-centric network measures I igraph:

visuzalization and measures for large graphs I InteractiveIGraph:

allow to work with ’igraph’ objects interactively

I visNetwork:

(9)

Introduction Overview of the package Demonstration What’s next

Literature review

Conclusion

I A lot of very specific tools

in particular for visualization and statistical analysis

I Nothing for (egocentric) network survey data

I No unified framework for storing and analysing

(10)

Introduction Overview of the package Demonstration What’s next

Outline

Introduction

Overview of the package Demonstration

What’s next

(11)

Introduction Overview of the package Demonstration What’s next

Overview of the package

Two new classes:

I NetworkVariable: designed to store network survey data

I NetworkMetadata: designed to store covariates

describing network members

(12)

Introduction Overview of the package Demonstration What’s next

Common network measures directly available:

I Density

I In-out degree

I Centrality

I Betweeness

I etc.

(13)

Introduction Overview of the package Demonstration What’s next

Tools for facilitating network structure analyses:

I net_extract:

Stem new networks by combining networks with metadata information

I net_query:

Query a network variable on its structure

(14)

Introduction Overview of the package Demonstration What’s next

Loading the package Data description

An example of network density analysis Operations available for structure analysis Stemming networks

Querying networks

Outline

Introduction

Overview of the package Demonstration

What’s next

(15)

Introduction Overview of the package Demonstration What’s next

Loading the package Data description

An example of network density analysis Operations available for structure analysis Stemming networks

Querying networks

Loading the package

library (Rsocialdata)

library (Rsocialdata.network)

(16)

Introduction Overview of the package Demonstration What’s next

Loading the package Data description

An example of network density analysis Operations available for structure analysis Stemming networks

Querying networks

Loading data

Data: a sample of the Geneva VLV database [Ludwig, C., Cavalli, S.,

& Oris, M. (2014)]

load(file="data/vlv_geneva.rda")

The data contains 4 network variables and 1 metadata network variable

ls ()

## [1] "net.conflit" "net.influence" "net.leger" "net.materiel"

(17)

Introduction Overview of the package Demonstration What’s next

Loading the package Data description

An example of network density analysis Operations available for structure analysis Stemming networks

Querying networks

Réseau de soutien émotionnel léger

description (net.leger)

## [1] "'X' (ligne) reçoit du soutien émotionnel de 'Y' (colonne)"

valids (net.leger)

## non selectionne oui

## 0 1

missings (net.leger)

(18)

Introduction Overview of the package Demonstration What’s next

Loading the package Data description

An example of network density analysis Operations available for structure analysis Stemming networks

Querying networks

net.leger[1]

## [[1]]

## ego 1 2 3 4 5

## ego 0 1 1 1 1 1

## 1 1 0 1 0 0 0

## 2 0 1 0 0 0 0

## 3 0 0 0 0 1 0

## 4 0 0 0 1 0 0

## 5 1 0 0 0 0 0

class (net.leger)[1]

## [1] "NetworkVariable"

(19)

Introduction Overview of the package Demonstration What’s next

Loading the package Data description

An example of network density analysis Operations available for structure analysis Stemming networks

Querying networks

Réseau de conflit

description (net.conflit)

## [1] "'X' (ligne) met en colère 'Y' (colonne)"

valids (net.conflit)

## non selectionne oui

## 0 1

missings (net.conflit)

(20)

Introduction Overview of the package Demonstration What’s next

Loading the package Data description

An example of network density analysis Operations available for structure analysis Stemming networks

Querying networks

net.conflit[1]

## [[1]]

## ego 1 2 3 4 5

## ego 0 0 0 0 0 0

## 1 0 0 0 0 0 0

## 2 0 0 0 0 0 0

## 3 0 0 0 0 0 0

## 4 0 0 0 0 0 0

## 5 0 0 0 0 0 0

class (net.conflit)[1]

## [1] "NetworkVariable"

(21)

Introduction Overview of the package Demonstration What’s next

Loading the package Data description

An example of network density analysis Operations available for structure analysis Stemming networks

Querying networks

Demographic data of network members

description (nmv)

## [1] "données socio-démographiques pour les 4 réseaux"

ncol (nmv)

## [1] 14

nrow (nmv) == nrow (vlv.study) * 5

(22)

Introduction Overview of the package Demonstration What’s next

Loading the package Data description

An example of network density analysis Operations available for structure analysis Stemming networks

Querying networks

nmv$id.ego[1:10]

## Description: IDs for ego

## [1] 1 1 1 1 1 2 2 2 2 2 nmv$id.alter[1:10]

## Description: IDs for alter

## [1] 1 2 3 4 5 1 2 3 4 5 nmv$sexe[1:10]

## Description: Sexe des membres du réseau

(23)

Introduction Overview of the package Demonstration What’s next

Loading the package Data description

An example of network density analysis Operations available for structure analysis Stemming networks

Querying networks

An example of network density analysis

Computing the density of all networks is easily done:

vlv.study$net.leger.density = net.density (net.leger, target = "oui")

(24)

Introduction Overview of the package Demonstration What’s next

Loading the package Data description

An example of network density analysis Operations available for structure analysis Stemming networks

Querying networks

For instance, we consider a network is dense when the density is over 0.5

vlv.study$net.leger.density.2 = cut (vlv.study$net.leger.density, breaks = 0.5) frequencies ("net.leger.density.2", vlv.study)

Coding Missing Label N N total Percent Percent (all) Percent total

0 [0,0.5] 437 77.62 77.62

1 (0.5,1] 126 563 22.38 22.38 100.00

563 100

(25)

Introduction Overview of the package Demonstration What’s next

Loading the package Data description

An example of network density analysis Operations available for structure analysis Stemming networks

Querying networks

And we assess the impact of the family configuration on being a dense network or not:

leger.density.reglog <- reglog (

formula = net.leger.density.2 ~ compclustr6hcousr, target= "(0.5,1]",

data = vlv.study

)

(26)

Introduction Overview of the package Demonstration What’s next

Loading the package Data description

An example of network density analysis Operations available for structure analysis Stemming networks

Querying networks

Results:

Model 1 compclustr6hcousrSon and co 1.166 compclustr6hcousrDaughter and co 0.410 * compclustr6hcousrSiblings 0.868 compclustr6hcousrKinship 0.302 * compclustr6hcousrSparse 0.257 ***

(Intercept) 0.414 ***

Table: Estimated coefficients (odds ratios) , *** < 0.001, ** <

0.01, * < 0.05, + < 0.1

(27)

Introduction Overview of the package Demonstration What’s next

Loading the package Data description

An example of network density analysis Operations available for structure analysis Stemming networks

Querying networks

Operations available for structure analysis

I action_rename

I action_remove

I condition_link

I condition_attribute

action_remove(x = "men", from = "sexe", direction = "all")

## Network operation 'action_remove' with parameter(s)

## x: 'men'

## from: 'sexe'

(28)

Introduction Overview of the package Demonstration What’s next

Loading the package Data description

An example of network density analysis Operations available for structure analysis Stemming networks

Querying networks

Manipulating the emotional support network

We start from:

net.leger[1]

## [[1]]

## ego 1 2 3 4 5

## ego 0 1 1 1 1 1

## 1 1 0 1 0 0 0

## 2 0 1 0 0 0 0

## 3 0 0 0 0 1 0

## 4 0 0 0 1 0 0

## 5 1 0 0 0 0 0

(29)

Introduction Overview of the package Demonstration What’s next

Loading the package Data description

An example of network density analysis Operations available for structure analysis Stemming networks

Querying networks

net.leger_lien_parente <- net_extract ( x = net.leger,

action_rename (by = "lien.de.parente.code") )

net.leger_lien_parente[1]

## [[1]]

## ego S SH IU GU B

## ego 0 1 1 1 1 1

## S 1 0 1 0 0 0

## SH 0 1 0 0 0 0

## IU 0 0 0 0 1 0

## GU 0 0 0 1 0 0

(30)

Introduction Overview of the package Demonstration What’s next

Loading the package Data description

An example of network density analysis Operations available for structure analysis Stemming networks

Querying networks

net.leger_without_son_all <- net_extract ( x = net.leger,

action_remove (x = "S", from = "lien.de.parente.code", direction = "all") )

net.leger_without_son_all[1]

## [[1]]

## ego 1 2 3 4 5

## ego 0 0 1 1 1 1

## 1 0 0 0 0 0 0

## 2 0 0 0 0 0 0

## 3 0 0 0 0 1 0

## 4 0 0 0 1 0 0

(31)

Introduction Overview of the package Demonstration What’s next

Loading the package Data description

An example of network density analysis Operations available for structure analysis Stemming networks

Querying networks

Now we combine operations:

net.leger_without_son_all <- net_extract ( x = net.leger,

action_rename(by = "lien.de.parente.code"),

action_remove (x = "S", from = "lien.de.parente.code", direction = "all") )

net.leger_without_son_all[1]

## [[1]]

## ego S SH IU GU B

## ego 0 0 1 1 1 1

## S 0 0 0 0 0 0

## SH 0 0 0 0 0 0

(32)

Introduction Overview of the package Demonstration What’s next

Loading the package Data description

An example of network density analysis Operations available for structure analysis Stemming networks

Querying networks

net.leger_without_son_in <- net_extract ( x = net.leger,

action_rename(by = "lien.de.parente.code"),

action_remove (x = "S", from = "lien.de.parente.code", direction = "in") )

net.leger_without_son_in[1]

## [[1]]

## ego S SH IU GU B

## ego 0 0 1 1 1 1

## S 1 0 1 0 0 0

## SH 0 0 0 0 0 0

## IU 0 0 0 0 1 0

## GU 0 0 0 1 0 0

(33)

Introduction Overview of the package Demonstration What’s next

Loading the package Data description

An example of network density analysis Operations available for structure analysis Stemming networks

Querying networks

net.leger_without_son_out <- net_extract ( x = net.leger,

action_rename(by = "lien.de.parente.code"),

action_remove (x = "S", from = "lien.de.parente.code", direction = "out") )

net.leger_without_son_out[1]

## [[1]]

## ego S SH IU GU B

## ego 0 1 1 1 1 1

## S 0 0 0 0 0 0

## SH 0 1 0 0 0 0

## IU 0 0 0 0 1 0

(34)

Introduction Overview of the package Demonstration What’s next

Loading the package Data description

An example of network density analysis Operations available for structure analysis Stemming networks

Querying networks

Querying the emotional support network

net.leger_link_son_daughter_xTOy = net_query ( x = net.leger,

condition_link(

x = "S", x.from = "lien.de.parente.code", y = "D", y.from = "lien.de.parente.code", direction = "xTOy"

) )

net.leger_link_son_daughter_xTOy[1:10]

## [1] NA NA FALSE NA TRUE NA NA NA NA NA

(35)

Introduction Overview of the package Demonstration What’s next

Loading the package Data description

An example of network density analysis Operations available for structure analysis Stemming networks

Querying networks

net.leger_link_son_daughter_yTOx = net_query(

x = net.leger, condition_link (

x = "S", x.from = "lien.de.parente.code", y = "D", y.from = "lien.de.parente.code", direction = "yTOx"

) )

net.leger_link_son_daughter_yTOx[1:10]

## [1] NA NA TRUE NA FALSE NA NA NA NA NA

(36)

Introduction Overview of the package Demonstration What’s next

Loading the package Data description

An example of network density analysis Operations available for structure analysis Stemming networks

Querying networks

net.leger_link_son_daughter_both = net_query(

x = net.leger, condition_link (

x = "S", x.from = "lien.de.parente.code", y = "D", y.from = "lien.de.parente.code", direction = "both"

) )

net.leger_link_son_daughter_both[1:10]

## [1] NA NA FALSE NA FALSE NA NA NA NA NA

(37)

Introduction Overview of the package Demonstration What’s next

Loading the package Data description

An example of network density analysis Operations available for structure analysis Stemming networks

Querying networks

Results:

summary (net.leger_link_son_daughter_xTOy)

## Mode FALSE TRUE NA's

## logical 100 58 405

summary (net.leger_link_son_daughter_yTOx)

## Mode FALSE TRUE NA's

## logical 102 56 405

summary (net.leger_link_son_daughter_both)

## Mode FALSE TRUE NA's

## logical 120 38 405

(38)

Introduction Overview of the package Demonstration What’s next

Outline

Introduction

Overview of the package Demonstration

What’s next

(39)

Introduction Overview of the package Demonstration What’s next

What’s next

Testing and documentating

I Testing on more databases

To capture all needs and fix possible bugs I Writing a user guide

All functions are documented but a quick start would be usefull

I Embed databases to write reproducible examples

(40)

Introduction Overview of the package Demonstration What’s next

Conclusion

The Rsocialdata.network extension provides tools for

I Storing network survey data

(missing values, weighting, etc.) I Documenting data

questions, values, variables, and surveys

I Quickly focus on data analysis

I

Common network measures directly available

I

Recoding tools and querying tools based on network

Références

Documents relatifs

Sociologists of technology have long relied on methods of network and textual analysis in order to capture the unfolding of controversies… Today the proliferation of digital

The network analyst extension makes it is easy to set the best rote analysis parameters, such as the travel time that will be used as an impedance factor, the start

Dentro de los alcances de este proyecto, se pretende desarrollar una m´ etrica basada en teor´ıa de grafos para medir matem´ atica- mente qu´ e tan robusta es la Internet chilena y,

D ATA A NALYSIS OF A N EGLECTED D ISEASE The use of data analysis for neglected diseases through bibliometric or social network on scientific publications is a way

The traffic shape inside a run, depicted in figure 7a, is related to the decreasing collision rate during the same time period, in figure

Currently dif- ferent biological types of data, such as sequences, protein structures and families, proteomics data, ontologies, gene expression and other experimental data are

In order to evaluate this approach, we applied the proposed techniques to a subset of judgments of the European Court of the Human Rights (ECtHR) and qualitatively vali- dated

Decision making problem is one of the most important field in multiple cri- teria decision (Triantaphyllou 2000 ). It exists many methods such as: Pareto analysis, decision