R statnet - grp month - compare graphs

2017.12.02 - work log - prelim - R - statnet - grp month

R network analysis files

Related files:

  • network descriptives

    • network-level

      • files

        • R scripts:

          • context_text/R/db_connect.r
          • context_text/R/sna/functions-sna.r
          • context_text/R/sna/sna-load_data.r
          • context_text/R/sna/igraph/*
          • context_text/R/sna/statnet/*
      • statnet/sna

        • sna::gden() - graph density
        • R scripts:

          • context_text/R/sna/statnet/sna-statnet-init.r
          • context_text/R/sna/statnet/sna-statnet-network-stats.r
          • context_text/R/sna/statnet/sna-qap.r
      • igraph

        • igraph::transitivity() - vector of transitivity scores for each node in a graph, plus network-level transitivity score.

          • Q - interpretation?
        • R scripts:

          • context_text/R/sna/statnet/sna-igraph-init.r
          • context_text/R/sna/statnet/sna-igraph-network-stats.r

Setup

Setup - working directories

Store important directories and file names in variables:


In [1]:
getwd()


'/home/jonathanmorgan/work/django/research/work/phd_work/methods/network_analysis/statnet'

In [2]:
# code files (in particular SNA and statnet function libraries, modest though they may be)
researchDirectory <- "/home/jonathanmorgan/work/django/research/"
contextAnalysisDirectory <- paste( researchDirectory, "/", 'context_analysis', sep = "" )
codeDirectory <- paste( contextAnalysisDirectory, "/", "R/sna", sep = "" )

# basic SNA functions
# - /home/jonathanmorgan/work/django/research/context_analysis/R/sna/functions-sna.r
#snaFunctionFilePath <- paste( codeDirectory, "/", 'functions-sna.r', sep = "" )

# statnet/sna functions
# - /home/jonathanmorgan/work/django/research/context_analysis/R/sna/stanet/functions-statnet.r
#statnetFunctionFilePath <- paste( codeDirectory, "/statnet/", 'functions-statnet.r', sep = "" )

# home directory
#homeDirectory <- getwd()
homeDirectory <- "/home/jonathanmorgan/work/django/research/work/phd_work/methods"

# data directories
dataDirectory <- paste( homeDirectory, "/data", sep = "" )
workspaceFileName <- "statnet-grp_month.RData"
workspaceFilePath <- paste( dataDirectory, "/", workspaceFileName )

In [3]:
# set working directory to data directory for now.
setwd( dataDirectory )
getwd()


'/home/jonathanmorgan/work/django/research/work/phd_work/methods/data'

Setup - import SNA functions

source the file functions-sna.r.


In [4]:
# basic SNA functions
# - /home/jonathanmorgan/work/django/research/context_analysis/R/sna/functions-sna.r
snaFunctionFilePath <- paste( codeDirectory, "/", 'functions-sna.r', sep = "" )

In [5]:
source( snaFunctionFilePath )

Setup - import statnet functions

source the file statnet/functions-statnet.r. This file includes:

  • compareMatricesQAP(), used extensively below.

In [6]:
# statnet/sna functions
# - /home/jonathanmorgan/work/django/research/context_analysis/R/sna/stanet/functions-statnet.r
statnetFunctionFilePath <- paste( codeDirectory, "/statnet/", 'functions-statnet.r', sep = "" )

In [7]:
source( statnetFunctionFilePath )


Loading required package: statnet.common

Attaching package: ‘statnet.common’

The following object is masked from ‘package:base’:

    order

Loading required package: network
network: Classes for Relational Data
Version 1.13.0.1 created on 2015-08-31.
copyright (c) 2005, Carter T. Butts, University of California-Irvine
                    Mark S. Handcock, University of California -- Los Angeles
                    David R. Hunter, Penn State University
                    Martina Morris, University of Washington
                    Skye Bender-deMoll, University of Washington
 For citation information, type citation("network").
 Type help("network-package") to get started.

sna: Tools for Social Network Analysis
Version 2.4 created on 2016-07-23.
copyright (c) 2005, Carter T. Butts, University of California-Irvine
 For citation information, type citation("sna").
 Type help(package="sna") to get started.

Setup - network data - render and store network data

First, need render to render network data and upload it to your server.

Directions for rendering network data are in 2017.11.14-work_log-prelim-network_analysis.ipynb. You want a tab-delimited matrix that includes both the network and attributes of nodes as columns, and you want it to include a header row.

Once you render your network data files, you should place them on the server.

High level data file layout:

  • tab-delimited.
  • first row and first column are labels
  • last 2 columns are traits of nodes (person_id and person_type)
  • each row and column after first until the trait columns represents a person found in one of the articles.
  • The people are in the same order from top to bottom and left to right.
  • Where the row and column of two people meet, and one of the people is an author, the nunber in the cell where they meet is the number of times the non-author was quoted in an article by the author. Does not include more basic two-mode co-location ties (appeared in same article, even if not an author and/or not quoted).

Files and their location on server:

data - grp_month

This is data from the Grand Rapids Press articles from December of 2009, coded by both humans and OpenCalais.

Files:

  • automated full month - sourcenet_data-20171205-022551-grp_month-automated.tab
  • human full month - sourcenet_data-20171115-043102-grp_month-human.tab
  • automated week 1 subset - sourcenet_data-20171206-031358-grp_month-automated-week1_subset.tab
  • human week 1 subset - sourcenet_data-20171206-031319-grp_month-human-week1_subset.tab
  • automated week 2 subset - sourcenet_data-20180326-040445-grp_month-automated-week2_subset.tab
  • human week 2 subset - sourcenet_data-20180326-034401-grp_month-human-week2_subset.tab
  • automated week 3 subset - sourcenet_data-20180326-040736-grp_month-automated-week3_subset.tab
  • human week 3 subset - sourcenet_data-20180326-034548-grp_month-human-week3_subset.tab

Location in Dropbox: Dropbox/academia/MSU/program_stuff/prelim_paper/data/network_analysis/2017.11.14/network/new_coders/grp_month

Location on server: /home/jonathanmorgan/work/django/research/work/phd_work/data/network/grp_month

Setup - load workspace

You must load this file's workspace, from a previous run:


In [8]:
# assumes that you've already set working directory above to the
#     working directory.
setwd( dataDirectory )
load( workspaceFileName )

Compare grp_week_1 and grp_week_2 using QAP

Now, compare the automated and human-coded networks from a week 1 and week 2 to each other, to look at similarity of weeks over time (I'd expect it to be small).

Based on: context_text/R/sna/statnet/sna-qap.r

week_1-to-week_2 - automated


In [9]:
outputPrefix <- "week_1-to-week_2 automated"

In [10]:
w1w2aOutput <- compareMatricesQAP( gw1AutomatedNetworkMatrix, gw2AutomatedNetworkMatrix, outputPrefix )


==> Start of  compareMatricesQAP  at  2019-07-25 02:29:17
----> week_1-to-week_2 automated graph correlation = 0.0425015271684107 ( @ 2019-07-25 02:29:17 )
----> week_1-to-week_2 automated QAP correlation analysis complete at 2019-07-25 02:32:51.  Summary:
QAP Test Results

Estimated p-values:
	p(f(perm) >= f(d)): 0 
	p(f(perm) <= f(d)): 1 

Test Diagnostics:
	Test Value (f(d)): 0.04250153 
	Replications: 1000 
	Distribution Summary:
		Min:	 -0.0004175996 
		1stQ:	 -0.0004175996 
		Med:	 -0.0004175996 
		Mean:	 4.224818e-05 
		3rdQ:	 -0.0004175996 
		Max:	 0.01184501 

----> week_1-to-week_2 automated graph covariance = 2.0377110575524e-05 ( @ 2019-07-25 02:32:51 )
----> week_1-to-week_2 automated QAP covariance analysis complete at 2019-07-25 02:35:57.  Summary:
QAP Test Results

Estimated p-values:
	p(f(perm) >= f(d)): 0 
	p(f(perm) <= f(d)): 1 

Test Diagnostics:
	Test Value (f(d)): 2.037711e-05 
	Replications: 1000 
	Distribution Summary:
		Min:	 -2.002157e-07 
		1stQ:	 -2.002157e-07 
		Med:	 -2.002157e-07 
		Mean:	 1.731603e-08 
		3rdQ:	 -2.002157e-07 
		Max:	 4.209211e-06 

----> week_1-to-week_2 automated graph hamming distance = 1186 ( @ 2019-07-25 02:35:57 )
----> week_1-to-week_2 automated QAP hamming distance analysis complete at 2019-07-25 02:38:43.  Summary:
QAP Test Results

Estimated p-values:
	p(f(perm) >= f(d)): 1 
	p(f(perm) <= f(d)): 0 

Test Diagnostics:
	Test Value (f(d)): 1186 
	Replications: 1000 
	Distribution Summary:
		Min:	 1206 
		1stQ:	 1218 
		Med:	 1218 
		Mean:	 1217.428 
		3rdQ:	 1218 
		Max:	 1218 

==> End of  compareMatricesQAP  at  2019-07-25 02:38:43

In [ ]:
# also output plots of distributions of QAP values?
displayCompareMatricesQAPOutput( w1w2aOutput, outputPrefix, TRUE )

week_1-to-week_2 - human


In [11]:
outputPrefix <- "week_1-to-week_2 human"

In [12]:
w1w2hOutput <- compareMatricesQAP( gw1HumanNetworkMatrix, gw2HumanNetworkMatrix, outputPrefix )


==> Start of  compareMatricesQAP  at  2019-07-25 02:38:43
----> week_1-to-week_2 human graph correlation = 0.0391487901001977 ( @ 2019-07-25 02:38:44 )
----> week_1-to-week_2 human QAP correlation analysis complete at 2019-07-25 02:41:50.  Summary:
QAP Test Results

Estimated p-values:
	p(f(perm) >= f(d)): 0 
	p(f(perm) <= f(d)): 1 

Test Diagnostics:
	Test Value (f(d)): 0.03914879 
	Replications: 1000 
	Distribution Summary:
		Min:	 -0.000447151 
		1stQ:	 -0.000447151 
		Med:	 -0.000447151 
		Mean:	 -5.967643e-05 
		3rdQ:	 -0.000447151 
		Max:	 0.008037694 

----> week_1-to-week_2 human graph covariance = 2.03449496390699e-05 ( @ 2019-07-25 02:41:51 )
----> week_1-to-week_2 human QAP covariance analysis complete at 2019-07-25 02:44:51.  Summary:
QAP Test Results

Estimated p-values:
	p(f(perm) >= f(d)): 0 
	p(f(perm) <= f(d)): 1 

Test Diagnostics:
	Test Value (f(d)): 2.034495e-05 
	Replications: 1000 
	Distribution Summary:
		Min:	 -2.323766e-07 
		1stQ:	 -2.323766e-07 
		Med:	 -2.323766e-07 
		Mean:	 -1.925434e-08 
		3rdQ:	 -2.323766e-07 
		Max:	 4.17705e-06 

----> week_1-to-week_2 human graph hamming distance = 1280 ( @ 2019-07-25 02:44:51 )
----> week_1-to-week_2 human QAP hamming distance analysis complete at 2019-07-25 02:47:34.  Summary:
QAP Test Results

Estimated p-values:
	p(f(perm) >= f(d)): 1 
	p(f(perm) <= f(d)): 0 

Test Diagnostics:
	Test Value (f(d)): 1280 
	Replications: 1000 
	Distribution Summary:
		Min:	 1296 
		1stQ:	 1316 
		Med:	 1316 
		Mean:	 1315.432 
		3rdQ:	 1316 
		Max:	 1316 

==> End of  compareMatricesQAP  at  2019-07-25 02:47:34

In [ ]:
# also output plots of distributions of QAP values?
displayCompareMatricesQAPOutput( w1w2hOutput, outputPrefix, TRUE )

Compare grp_week_1 and grp_week_3 using QAP

Now, compare the automated and human-coded networks from a week 1 and week 3 to each other, to look at similarity of weeks over time (I'd expect it to be small).

Based on: context_text/R/sna/statnet/sna-qap.r

week_1-to-week_3 - automated


In [13]:
outputPrefix <- "week_1-to-week_3 automated"

In [14]:
w1w3aOutput <- compareMatricesQAP( gw1AutomatedNetworkMatrix, gw3AutomatedNetworkMatrix, outputPrefix )


==> Start of  compareMatricesQAP  at  2019-07-25 02:47:34
----> week_1-to-week_3 automated graph correlation = 0.0262884654712309 ( @ 2019-07-25 02:47:34 )
----> week_1-to-week_3 automated QAP correlation analysis complete at 2019-07-25 02:50:44.  Summary:
QAP Test Results

Estimated p-values:
	p(f(perm) >= f(d)): 0 
	p(f(perm) <= f(d)): 1 

Test Diagnostics:
	Test Value (f(d)): 0.02628847 
	Replications: 1000 
	Distribution Summary:
		Min:	 -0.0003917907 
		1stQ:	 -0.0003917907 
		Med:	 -0.0003917907 
		Mean:	 5.176857e-05 
		3rdQ:	 -0.0003917907 
		Max:	 0.009613305 

----> week_1-to-week_3 automated graph covariance = 1.1585802910022e-05 ( @ 2019-07-25 02:50:44 )
----> week_1-to-week_3 automated QAP covariance analysis complete at 2019-07-25 02:53:48.  Summary:
QAP Test Results

Estimated p-values:
	p(f(perm) >= f(d)): 0 
	p(f(perm) <= f(d)): 1 

Test Diagnostics:
	Test Value (f(d)): 1.15858e-05 
	Replications: 1000 
	Distribution Summary:
		Min:	 -1.726693e-07 
		1stQ:	 -1.726693e-07 
		Med:	 -1.726693e-07 
		Mean:	 -7.015975e-10 
		3rdQ:	 -1.726693e-07 
		Max:	 4.236758e-06 

----> week_1-to-week_3 automated graph hamming distance = 1112 ( @ 2019-07-25 02:53:48 )
----> week_1-to-week_3 automated QAP hamming distance analysis complete at 2019-07-25 02:56:35.  Summary:
QAP Test Results

Estimated p-values:
	p(f(perm) >= f(d)): 1 
	p(f(perm) <= f(d)): 0 

Test Diagnostics:
	Test Value (f(d)): 1112 
	Replications: 1000 
	Distribution Summary:
		Min:	 1124 
		1stQ:	 1136 
		Med:	 1136 
		Mean:	 1135.592 
		3rdQ:	 1136 
		Max:	 1136 

==> End of  compareMatricesQAP  at  2019-07-25 02:56:35

In [ ]:
# also output plots of distributions of QAP values?
displayCompareMatricesQAPOutput( w1w3aOutput, outputPrefix, TRUE )

week_1-to-week_3 - human


In [15]:
outputPrefix <- "week_1-to-week_3 human"

In [16]:
w1w3hOutput <- compareMatricesQAP( gw1HumanNetworkMatrix, gw3HumanNetworkMatrix, outputPrefix )


==> Start of  compareMatricesQAP  at  2019-07-25 02:56:35
----> week_1-to-week_3 human graph correlation = 0.0269444521618076 ( @ 2019-07-25 02:56:35 )
----> week_1-to-week_3 human QAP correlation analysis complete at 2019-07-25 03:00:23.  Summary:
QAP Test Results

Estimated p-values:
	p(f(perm) >= f(d)): 0 
	p(f(perm) <= f(d)): 1 

Test Diagnostics:
	Test Value (f(d)): 0.02694445 
	Replications: 1000 
	Distribution Summary:
		Min:	 -0.0004300933 
		1stQ:	 -0.0004300933 
		Med:	 -0.0004300933 
		Mean:	 1.816231e-06 
		3rdQ:	 -0.0004300933 
		Max:	 0.01173637 

----> week_1-to-week_3 human graph covariance = 1.30204459652099e-05 ( @ 2019-07-25 03:00:23 )
----> week_1-to-week_3 human QAP covariance analysis complete at 2019-07-25 03:03:54.  Summary:
QAP Test Results

Estimated p-values:
	p(f(perm) >= f(d)): 0 
	p(f(perm) <= f(d)): 1 

Test Diagnostics:
	Test Value (f(d)): 1.302045e-05 
	Replications: 1000 
	Distribution Summary:
		Min:	 -2.078352e-07 
		1stQ:	 -2.078352e-07 
		Med:	 -2.078352e-07 
		Mean:	 1.116633e-08 
		3rdQ:	 -2.078352e-07 
		Max:	 5.671401e-06 

----> week_1-to-week_3 human graph hamming distance = 1224 ( @ 2019-07-25 03:03:54 )
----> week_1-to-week_3 human QAP hamming distance analysis complete at 2019-07-25 03:06:55.  Summary:
QAP Test Results

Estimated p-values:
	p(f(perm) >= f(d)): 1 
	p(f(perm) <= f(d)): 0 

Test Diagnostics:
	Test Value (f(d)): 1224 
	Replications: 1000 
	Distribution Summary:
		Min:	 1240 
		1stQ:	 1252 
		Med:	 1252 
		Mean:	 1251.468 
		3rdQ:	 1252 
		Max:	 1252 

==> End of  compareMatricesQAP  at  2019-07-25 03:06:55

In [ ]:
# also output plots of distributions of QAP values?
displayCompareMatricesQAPOutput( w1w3hOutput, outputPrefix, TRUE )

Compare grp_week_2 and grp_week_3 using QAP

Now, compare the automated and human-coded networks from a week 2 and week 3 to each other, to look at similarity of weeks over time (I'd expect it to be small).

Based on: context_text/R/sna/statnet/sna-qap.r

week_2-to-week_3 - automated


In [17]:
outputPrefix <- "week_2-to-week_3 automated"

In [18]:
w2w3aOutput <- compareMatricesQAP( gw2AutomatedNetworkMatrix, gw3AutomatedNetworkMatrix, outputPrefix )


==> Start of  compareMatricesQAP  at  2019-07-25 03:06:55
----> week_2-to-week_3 automated graph correlation = 0.0237206678784088 ( @ 2019-07-25 03:06:55 )
----> week_2-to-week_3 automated QAP correlation analysis complete at 2019-07-25 03:10:05.  Summary:
QAP Test Results

Estimated p-values:
	p(f(perm) >= f(d)): 0 
	p(f(perm) <= f(d)): 1 

Test Diagnostics:
	Test Value (f(d)): 0.02372067 
	Replications: 1000 
	Distribution Summary:
		Min:	 -0.0003876854 
		1stQ:	 -0.0003876854 
		Med:	 -0.0003876854 
		Mean:	 -1.917203e-05 
		3rdQ:	 -0.0003876854 
		Max:	 0.006500416 

----> week_2-to-week_3 automated graph covariance = 1.01232115754695e-05 ( @ 2019-07-25 03:10:05 )
----> week_2-to-week_3 automated QAP covariance analysis complete at 2019-07-25 03:13:06.  Summary:
QAP Test Results

Estimated p-values:
	p(f(perm) >= f(d)): 0 
	p(f(perm) <= f(d)): 1 

Test Diagnostics:
	Test Value (f(d)): 1.012321e-05 
	Replications: 1000 
	Distribution Summary:
		Min:	 -1.654516e-07 
		1stQ:	 -1.654516e-07 
		Med:	 -1.654516e-07 
		Mean:	 1.974437e-08 
		3rdQ:	 -1.654516e-07 
		Max:	 5.713785e-06 

----> week_2-to-week_3 automated graph hamming distance = 1082 ( @ 2019-07-25 03:13:06 )
----> week_2-to-week_3 automated QAP hamming distance analysis complete at 2019-07-25 03:15:49.  Summary:
QAP Test Results

Estimated p-values:
	p(f(perm) >= f(d)): 1 
	p(f(perm) <= f(d)): 0 

Test Diagnostics:
	Test Value (f(d)): 1082 
	Replications: 1000 
	Distribution Summary:
		Min:	 1102 
		1stQ:	 1110 
		Med:	 1110 
		Mean:	 1109.532 
		3rdQ:	 1110 
		Max:	 1110 

==> End of  compareMatricesQAP  at  2019-07-25 03:15:49

In [ ]:
# also output plots of distributions of QAP values?
displayCompareMatricesQAPOutput( w2w3aOutput, outputPrefix, TRUE )

week_2-to-week_3 - human


In [19]:
outputPrefix <- "week_2-to-week_3 human"

In [20]:
w2w3hOutput <- compareMatricesQAP( gw2HumanNetworkMatrix, gw3HumanNetworkMatrix, outputPrefix )


==> Start of  compareMatricesQAP  at  2019-07-25 03:15:49
----> week_2-to-week_3 human graph correlation = 0.0293939514488537 ( @ 2019-07-25 03:15:49 )
----> week_2-to-week_3 human QAP correlation analysis complete at 2019-07-25 03:18:57.  Summary:
QAP Test Results

Estimated p-values:
	p(f(perm) >= f(d)): 0 
	p(f(perm) <= f(d)): 1 

Test Diagnostics:
	Test Value (f(d)): 0.02939395 
	Replications: 1000 
	Distribution Summary:
		Min:	 -0.0003995317 
		1stQ:	 -0.0003995317 
		Med:	 -0.0003995317 
		Mean:	 -2.214761e-05 
		3rdQ:	 -0.0003995317 
		Max:	 0.009531629 

----> week_2-to-week_3 human graph covariance = 1.30508894337734e-05 ( @ 2019-07-25 03:18:57 )
----> week_2-to-week_3 human QAP covariance analysis complete at 2019-07-25 03:22:31.  Summary:
QAP Test Results

Estimated p-values:
	p(f(perm) >= f(d)): 0 
	p(f(perm) <= f(d)): 1 

Test Diagnostics:
	Test Value (f(d)): 1.305089e-05 
	Replications: 1000 
	Distribution Summary:
		Min:	 -1.773917e-07 
		1stQ:	 -1.773917e-07 
		Med:	 -1.773917e-07 
		Mean:	 -8.363712e-09 
		3rdQ:	 -1.773917e-07 
		Max:	 5.701844e-06 

----> week_2-to-week_3 human graph hamming distance = 1116 ( @ 2019-07-25 03:22:31 )
----> week_2-to-week_3 human QAP hamming distance analysis complete at 2019-07-25 03:25:29.  Summary:
QAP Test Results

Estimated p-values:
	p(f(perm) >= f(d)): 1 
	p(f(perm) <= f(d)): 0 

Test Diagnostics:
	Test Value (f(d)): 1116 
	Replications: 1000 
	Distribution Summary:
		Min:	 1136 
		1stQ:	 1148 
		Med:	 1148 
		Mean:	 1147.532 
		3rdQ:	 1148 
		Max:	 1148 

==> End of  compareMatricesQAP  at  2019-07-25 03:25:29

In [ ]:
# also output plots of distributions of QAP values?
displayCompareMatricesQAPOutput( w2w3hOutput, outputPrefix, TRUE )

Compare grp_month and grp_week_1 using QAP

Now, compare the automated and human-coded networks from the full month and week 1 against each other, to see what more time gets you.

Based on: context_text/R/sna/statnet/sna-qap.r

month-to-week_1 - automated


In [21]:
outputPrefix <- "month-to-week_1 automated"

In [22]:
mw1aOutput <- compareMatricesQAP( gmAutomatedNetworkMatrix, gw1AutomatedNetworkMatrix, outputPrefix )


==> Start of  compareMatricesQAP  at  2019-07-25 03:25:29
----> month-to-week_1 automated graph correlation = 0.521381854496348 ( @ 2019-07-25 03:25:30 )
----> month-to-week_1 automated QAP correlation analysis complete at 2019-07-25 03:29:08.  Summary:
QAP Test Results

Estimated p-values:
	p(f(perm) >= f(d)): 0 
	p(f(perm) <= f(d)): 1 

Test Diagnostics:
	Test Value (f(d)): 0.5213819 
	Replications: 1000 
	Distribution Summary:
		Min:	 -0.0007992741 
		1stQ:	 -0.0007992741 
		Med:	 -0.0007992741 
		Mean:	 -4.890125e-05 
		3rdQ:	 0.0006006753 
		Max:	 0.006200473 

----> month-to-week_1 automated graph covariance = 0.000547399605464319 ( @ 2019-07-25 03:29:09 )
----> month-to-week_1 automated QAP covariance analysis complete at 2019-07-25 03:32:28.  Summary:
QAP Test Results

Estimated p-values:
	p(f(perm) >= f(d)): 0 
	p(f(perm) <= f(d)): 1 

Test Diagnostics:
	Test Value (f(d)): 0.0005473996 
	Replications: 1000 
	Distribution Summary:
		Min:	 -8.391591e-07 
		1stQ:	 -8.391591e-07 
		Med:	 -8.391591e-07 
		Mean:	 3.537724e-08 
		3rdQ:	 6.306499e-07 
		Max:	 2.414759e-05 

----> month-to-week_1 automated graph hamming distance = 1876 ( @ 2019-07-25 03:32:28 )
----> month-to-week_1 automated QAP hamming distance analysis complete at 2019-07-25 03:35:17.  Summary:
QAP Test Results

Estimated p-values:
	p(f(perm) >= f(d)): 1 
	p(f(perm) <= f(d)): 0 

Test Diagnostics:
	Test Value (f(d)): 1876 
	Replications: 1000 
	Distribution Summary:
		Min:	 3096 
		1stQ:	 3116 
		Med:	 3120 
		Mean:	 3118.044 
		3rdQ:	 3120 
		Max:	 3120 

==> End of  compareMatricesQAP  at  2019-07-25 03:35:17

In [ ]:
# also output plots of distributions of QAP values?
displayCompareMatricesQAPOutput( mw1aOutput, outputPrefix, TRUE )

month-to-week_1 - human


In [23]:
outputPrefix <- "month-to-week_1 human"

In [24]:
mw1hOutput <- compareMatricesQAP( gmHumanNetworkMatrix, gw1HumanNetworkMatrix, outputPrefix )


==> Start of  compareMatricesQAP  at  2019-07-25 03:35:17
----> month-to-week_1 human graph correlation = 0.538643365355464 ( @ 2019-07-25 03:35:18 )
----> month-to-week_1 human QAP correlation analysis complete at 2019-07-25 03:38:23.  Summary:
QAP Test Results

Estimated p-values:
	p(f(perm) >= f(d)): 0 
	p(f(perm) <= f(d)): 1 

Test Diagnostics:
	Test Value (f(d)): 0.5386434 
	Replications: 1000 
	Distribution Summary:
		Min:	 -0.0008668826 
		1stQ:	 -0.0008668826 
		Med:	 -0.0008668826 
		Mean:	 6.670216e-06 
		3rdQ:	 0.0003936554 
		Max:	 0.01930172 

----> month-to-week_1 human graph covariance = 0.000628067460651923 ( @ 2019-07-25 03:38:24 )
----> month-to-week_1 human QAP covariance analysis complete at 2019-07-25 03:41:22.  Summary:
QAP Test Results

Estimated p-values:
	p(f(perm) >= f(d)): 0 
	p(f(perm) <= f(d)): 1 

Test Diagnostics:
	Test Value (f(d)): 0.0006280675 
	Replications: 1000 
	Distribution Summary:
		Min:	 -1.0108e-06 
		1stQ:	 -1.0108e-06 
		Med:	 -1.0108e-06 
		Mean:	 1.365682e-08 
		3rdQ:	 4.59009e-07 
		Max:	 1.074767e-05 

----> month-to-week_1 human graph hamming distance = 1926 ( @ 2019-07-25 03:41:22 )
----> month-to-week_1 human QAP hamming distance analysis complete at 2019-07-25 03:44:07.  Summary:
QAP Test Results

Estimated p-values:
	p(f(perm) >= f(d)): 1 
	p(f(perm) <= f(d)): 0 

Test Diagnostics:
	Test Value (f(d)): 1926 
	Replications: 1000 
	Distribution Summary:
		Min:	 3326 
		1stQ:	 3342 
		Med:	 3346 
		Mean:	 3343.572 
		3rdQ:	 3346 
		Max:	 3346 

==> End of  compareMatricesQAP  at  2019-07-25 03:44:07

In [ ]:
# also output plots of distributions of QAP values?
displayCompareMatricesQAPOutput( mw1hOutput, outputPrefix, TRUE )

Compare grp_month and grp_week_2 using QAP

Now, compare the automated and human-coded networks from the full month and week 2 against each other, to see what more time gets you.

Based on: context_text/R/sna/statnet/sna-qap.r

month-to-week_2 - automated


In [25]:
outputPrefix <- "month-to-week_2 automated"

In [26]:
mw2aOutput <- compareMatricesQAP( gmAutomatedNetworkMatrix, gw2AutomatedNetworkMatrix, outputPrefix )


==> Start of  compareMatricesQAP  at  2019-07-25 03:44:07
----> month-to-week_2 automated graph correlation = 0.526894046954591 ( @ 2019-07-25 03:44:07 )
----> month-to-week_2 automated QAP correlation analysis complete at 2019-07-25 03:47:05.  Summary:
QAP Test Results

Estimated p-values:
	p(f(perm) >= f(d)): 0 
	p(f(perm) <= f(d)): 1 

Test Diagnostics:
	Test Value (f(d)): 0.526894 
	Replications: 1000 
	Distribution Summary:
		Min:	 -0.0007908992 
		1stQ:	 -0.0007908992 
		Med:	 -0.0007908992 
		Mean:	 -6.80431e-05 
		3rdQ:	 0.000654813 
		Max:	 0.006437662 

----> month-to-week_2 automated graph covariance = 0.000535676210692771 ( @ 2019-07-25 03:47:05 )
----> month-to-week_2 automated QAP covariance analysis complete at 2019-07-25 03:50:09.  Summary:
QAP Test Results

Estimated p-values:
	p(f(perm) >= f(d)): 0 
	p(f(perm) <= f(d)): 1 

Test Diagnostics:
	Test Value (f(d)): 0.0005356762 
	Replications: 1000 
	Distribution Summary:
		Min:	 -8.040817e-07 
		1stQ:	 -8.040817e-07 
		Med:	 -8.040817e-07 
		Mean:	 -2.508296e-08 
		3rdQ:	 6.657273e-07 
		Max:	 6.544963e-06 

----> month-to-week_2 automated graph hamming distance = 1902 ( @ 2019-07-25 03:50:09 )
----> month-to-week_2 automated QAP hamming distance analysis complete at 2019-07-25 03:52:58.  Summary:
QAP Test Results

Estimated p-values:
	p(f(perm) >= f(d)): 1 
	p(f(perm) <= f(d)): 0 

Test Diagnostics:
	Test Value (f(d)): 1902 
	Replications: 1000 
	Distribution Summary:
		Min:	 3078 
		1stQ:	 3090 
		Med:	 3094 
		Mean:	 3092.076 
		3rdQ:	 3094 
		Max:	 3094 

==> End of  compareMatricesQAP  at  2019-07-25 03:52:58

In [ ]:
# also output plots of distributions of QAP values?
displayCompareMatricesQAPOutput( mw2aOutput, outputPrefix, TRUE )

month-to-week_2 - human


In [27]:
outputPrefix <- "month-to-week_2 human"

In [28]:
mw2hOutput <- compareMatricesQAP( gmHumanNetworkMatrix, gw2HumanNetworkMatrix, outputPrefix )


==> Start of  compareMatricesQAP  at  2019-07-25 03:52:58
----> month-to-week_2 human graph correlation = 0.516410349744311 ( @ 2019-07-25 03:52:58 )
----> month-to-week_2 human QAP correlation analysis complete at 2019-07-25 04:08:29.  Summary:
QAP Test Results

Estimated p-values:
	p(f(perm) >= f(d)): 0 
	p(f(perm) <= f(d)): 1 

Test Diagnostics:
	Test Value (f(d)): 0.5164103 
	Replications: 1000 
	Distribution Summary:
		Min:	 -0.0008052837 
		1stQ:	 -0.0008052837 
		Med:	 -0.0008052837 
		Mean:	 5.523808e-06 
		3rdQ:	 0.000566641 
		Max:	 0.01291396 

----> month-to-week_2 human graph covariance = 0.00055325526146777 ( @ 2019-07-25 04:08:29 )
----> month-to-week_2 human QAP covariance analysis complete at 2019-07-25 04:11:35.  Summary:
QAP Test Results

Estimated p-values:
	p(f(perm) >= f(d)): 0 
	p(f(perm) <= f(d)): 1 

Test Diagnostics:
	Test Value (f(d)): 0.0005532553 
	Replications: 1000 
	Distribution Summary:
		Min:	 -8.627392e-07 
		1stQ:	 -8.627392e-07 
		Med:	 -8.627392e-07 
		Mean:	 1.032735e-08 
		3rdQ:	 6.070698e-07 
		Max:	 1.824478e-05 

----> month-to-week_2 human graph hamming distance = 2030 ( @ 2019-07-25 04:11:35 )
----> month-to-week_2 human QAP hamming distance analysis complete at 2019-07-25 04:14:15.  Summary:
QAP Test Results

Estimated p-values:
	p(f(perm) >= f(d)): 1 
	p(f(perm) <= f(d)): 0 

Test Diagnostics:
	Test Value (f(d)): 2030 
	Replications: 1000 
	Distribution Summary:
		Min:	 3214 
		1stQ:	 3238 
		Med:	 3242 
		Mean:	 3239.928 
		3rdQ:	 3242 
		Max:	 3242 

==> End of  compareMatricesQAP  at  2019-07-25 04:14:15

In [ ]:
# also output plots of distributions of QAP values?
displayCompareMatricesQAPOutput( mw2hOutput, outputPrefix, TRUE )

Compare grp_month and grp_week_3 using QAP

Now, compare the automated and human-coded networks from the full month and week 3 against each other, to see what more time gets you.

Based on: context_text/R/sna/statnet/sna-qap.r

month-to-week_3 - automated


In [29]:
outputPrefix <- "month-to-week_3 automated"

In [30]:
mw3aOutput <- compareMatricesQAP( gmAutomatedNetworkMatrix, gw3AutomatedNetworkMatrix, outputPrefix )


==> Start of  compareMatricesQAP  at  2019-07-25 04:14:15
----> month-to-week_3 automated graph correlation = 0.449063768979808 ( @ 2019-07-25 04:14:16 )
----> month-to-week_3 automated QAP correlation analysis complete at 2019-07-25 04:17:20.  Summary:
QAP Test Results

Estimated p-values:
	p(f(perm) >= f(d)): 0 
	p(f(perm) <= f(d)): 1 

Test Diagnostics:
	Test Value (f(d)): 0.4490638 
	Replications: 1000 
	Distribution Summary:
		Min:	 -0.0007420192 
		1stQ:	 -0.0007420192 
		Med:	 -0.0007420192 
		Mean:	 -2.484636e-05 
		3rdQ:	 0.0008307283 
		Max:	 0.007121718 

----> month-to-week_3 automated graph covariance = 0.000419671926779777 ( @ 2019-07-25 04:17:20 )
----> month-to-week_3 automated QAP covariance analysis complete at 2019-07-25 04:20:15.  Summary:
QAP Test Results

Estimated p-values:
	p(f(perm) >= f(d)): 0 
	p(f(perm) <= f(d)): 1 

Test Diagnostics:
	Test Value (f(d)): 0.0004196719 
	Replications: 1000 
	Distribution Summary:
		Min:	 -6.93453e-07 
		1stQ:	 -6.93453e-07 
		Med:	 -6.93453e-07 
		Mean:	 1.031834e-07 
		3rdQ:	 7.76356e-07 
		Max:	 1.106502e-05 

----> month-to-week_3 automated graph hamming distance = 1984 ( @ 2019-07-25 04:20:15 )
----> month-to-week_3 automated QAP hamming distance analysis complete at 2019-07-25 04:22:59.  Summary:
QAP Test Results

Estimated p-values:
	p(f(perm) >= f(d)): 1 
	p(f(perm) <= f(d)): 0 

Test Diagnostics:
	Test Value (f(d)): 1984 
	Replications: 1000 
	Distribution Summary:
		Min:	 2996 
		1stQ:	 3008 
		Med:	 3012 
		Mean:	 3010.368 
		3rdQ:	 3012 
		Max:	 3012 

==> End of  compareMatricesQAP  at  2019-07-25 04:22:59

In [ ]:
# also output plots of distributions of QAP values?
displayCompareMatricesQAPOutput( mw3aOutput, outputPrefix, TRUE )

month-to-week_3 - human


In [31]:
outputPrefix <- "month-to-week_3 human"

In [32]:
mw3hOutput <- compareMatricesQAP( gmHumanNetworkMatrix, gw3HumanNetworkMatrix, outputPrefix )


==> Start of  compareMatricesQAP  at  2019-07-25 04:22:59
----> month-to-week_3 human graph correlation = 0.44922480558016 ( @ 2019-07-25 04:23:00 )
----> month-to-week_3 human QAP correlation analysis complete at 2019-07-25 04:26:14.  Summary:
QAP Test Results

Estimated p-values:
	p(f(perm) >= f(d)): 0 
	p(f(perm) <= f(d)): 1 

Test Diagnostics:
	Test Value (f(d)): 0.4492248 
	Replications: 1000 
	Distribution Summary:
		Min:	 -0.0007745641 
		1stQ:	 -0.0007745641 
		Med:	 -0.0007745641 
		Mean:	 -1.177827e-05 
		3rdQ:	 0.0007008437 
		Max:	 0.0110287 

----> month-to-week_3 human graph covariance = 0.000447520126373497 ( @ 2019-07-25 04:26:14 )
----> month-to-week_3 human QAP covariance analysis complete at 2019-07-25 04:29:25.  Summary:
QAP Test Results

Estimated p-values:
	p(f(perm) >= f(d)): 0 
	p(f(perm) <= f(d)): 1 

Test Diagnostics:
	Test Value (f(d)): 0.0004475201 
	Replications: 1000 
	Distribution Summary:
		Min:	 -7.716248e-07 
		1stQ:	 -7.716248e-07 
		Med:	 -7.716248e-07 
		Mean:	 -2.496186e-08 
		3rdQ:	 6.981842e-07 
		Max:	 8.047229e-06 

----> month-to-week_3 human graph hamming distance = 2094 ( @ 2019-07-25 04:29:25 )
----> month-to-week_3 human QAP hamming distance analysis complete at 2019-07-25 04:32:14.  Summary:
QAP Test Results

Estimated p-values:
	p(f(perm) >= f(d)): 1 
	p(f(perm) <= f(d)): 0 

Test Diagnostics:
	Test Value (f(d)): 2094 
	Replications: 1000 
	Distribution Summary:
		Min:	 3158 
		1stQ:	 3174 
		Med:	 3178 
		Mean:	 3176.18 
		3rdQ:	 3178 
		Max:	 3178 

==> End of  compareMatricesQAP  at  2019-07-25 04:32:14

In [ ]:
# also output plots of distributions of QAP values?
displayCompareMatricesQAPOutput( mw3hOutput, outputPrefix, TRUE )

Save workspace image

Save all the information in the current image, in case we need/want it later.


In [33]:
# help( save.image )
save.image( file = workspace_file_name )