| Title: | Methods and Measures for Semantic Network Analysis |
| Version: | 1.4.5 |
| Date: | 2025-11-03 |
| Maintainer: | Alexander P. Christensen <alexpaulchristensen@gmail.com> |
| Description: | Implements several functions for the analysis of semantic networks including different network estimation algorithms, partial node bootstrapping (Kenett, Anaki, & Faust, 2014 <doi:10.3389/fnhum.2014.00407>), random walk simulation (Kenett & Austerweil, 2016http://alab.psych.wisc.edu/papers/files/Kenett16CreativityRW.pdf), and a function to compute global network measures. Significance tests and plotting features are also implemented. |
| Depends: | R (≥ 3.6.0) |
| License: | GPL (≥ 3.0) |
| Encoding: | UTF-8 |
| LazyData: | true |
| Imports: | pbapply, dplyr, plyr, magrittr, ggplot2, igraph, qgraph,scales, car, broom, effects, methods, philentropy |
| URL: | https://github.com/AlexChristensen/SemNeT |
| BugReports: | https://github.com/AlexChristensen/SemNeT/issues |
| NeedsCompilation: | no |
| Suggests: | shiny, shinyjs, shinyalert, shinyMatrix, shinyBS, animation,R.matlab, foreign, readxl, data.table, NetworkToolbox,SemNetCleaner, SemNetDictionaries |
| RoxygenNote: | 7.3.3 |
| Packaged: | 2025-11-03 11:41:00 UTC; alextops |
| Author: | Alexander P. Christensen |
| Repository: | CRAN |
| Date/Publication: | 2025-11-03 13:10:02 UTC |
SemNeT–package
Description
Implements several functions for the analysis of semanticnetworks including partial node bootstraping (Kenett, Anaki, & Faust, 2014),random walk simulation (Kenett & Austerweil, 2016), and a function to computeglobal network measures. Significance tests and plotting features are alsoimplemented.
Author(s)
Alexander P. Christensen <alexpaulchristensen@gmail.com> & Yoed N. Kenett <yoedkenett@gmail.com>
References
Christensen, A. P., Kenett, Y. N., Cotter, K. N., Beaty, R. E., & Silvia, P. J. (2018).Remotely close associations: Openness to experience and semantic memory structure.European Journal of Personality,32, 480-492.
Kenett, Y. N., Anaki, D., & Faust, M. (2014).Investigating the structure of semantic networks in low and high creative persons.Frontiers in Human Neuroscience,8, 407.
Kenett, Y. N., & Austerweil, J. L. (2016).Examining search processes in low and high creative individuals with random walks.InPaper presented at the proceedings of the 38th annual meeting of the cognitive science society. Austin, TX.
See Also
Useful links:
Report bugs athttps://github.com/AlexChristensen/SemNeT/issues
Average Shortest Path Length
Description
Computes the global average shortest path length of the network
Usage
ASPL(A, weighted = FALSE)Arguments
A | An adjacency matrix of network data |
weighted | Is the network weighted?Defaults to |
Value
Returns the ASPL of the network
Author(s)
Alexander Christensen <alexpaulchristensen@gmail.com>
References
Rubinov, M., & Sporns, O. (2010). Complex network measures of brain connectivity: Uses and interpretations.NeuroImage,52, 1059-1069.
Examples
# Pearson's correlation only for CRAN checksA <- TMFG(similarity(sim.fluency(100), method = "cor"))# Unweightedaspl <- ASPL(A)Clustering Coefficient
Description
Computes global clustering coefficient CC
Usage
CC(A, weighted = FALSE)Arguments
A | An adjacency matrix of network data |
weighted | Is the network weighted?Defaults to |
Value
Returns the network's CC
Author(s)
Alexander Christensen <alexpaulchristensen@gmail.com>
References
Rubinov, M., & Sporns, O. (2010). Complex network measures of brain connectivity: Uses and interpretations.NeuroImage,52, 1059-1069.
Examples
# Pearson's correlation only for CRAN checksA <- TMFG(similarity(sim.fluency(100), method = "cor"))# Unweightedcc <- CC(A)Community Network Estimation
Description
Estimates a semantic network using the Community Networkmethod described in Goni et al. (2011)
Usage
CN(data, window = 2, alpha = 0.05, enrich = FALSE)Arguments
data | Matrix or data frame.A preprocessed verbal fluency matrix whererows are participants and columns are verbal fluencyresponses |
window | Numeric.Size of window to look for co-occurences in.Defaults to |
alpha | Numeric.Significance value.Defaults to |
enrich | Boolean.Should the network be enriched by connectingall nodes in their respective modules?Defaults to |
Value
Returns a undirected semantic network
Author(s)
Alexander Christensen <alexpaulchristensen@gmail.com>
References
Goni, J., Arrondo, G., Sepulcre, J., Martincorena, I., de Mendizabal, N. V., Corominas-Murtra, B., ... & Villoslada, P. (2011).The semantic organization of the animal category: Evidence from semantic verbal fluency and network theory.Cognitive Processing,12, 183-196.
Examples
# Get datadata <- open.clean# Organize group data## Get group datagroup <- open.group## Low and high openness to experience groupslow <- data[which(group == "Low"),]high <- data[which(group == "High"),]## Not run: # Compute networkslow.net <- CN(low)high.net <- CN(high)## End(Not run)Naive Random Walk Network Estimation
Description
Estimates a semantic network using the Naive Random Walkmethod described in Lerner, Ogrocki, and Thomas (2009)
Usage
NRW(data, type = c("num", "prop"), threshold = 0)Arguments
data | Matrix or data frame.A preprocessed verbal fluency matrix whererows are participants and columns are verbal fluencyresponses |
type | Character.Type of
Defaults to |
threshold | Numeric.Value of the minimum number or proportion of co-occurrences.Defaults to |
Value
Returns a undirected semantic network
Author(s)
Alexander Christensen <alexpaulchristensen@gmail.com>
References
Lerner, A. J., Ogrocki, P. K., & Thomas, P. J. (2009).Network graph analysis of category fluency testing.Cognitive and Behavioral Neurology,22, 45-52.
Examples
# Get datadata <- open.clean# Organize group data## Get group datagroup <- open.group## Low and high openness to experience groupslow <- data[which(group == "Low"),]high <- data[which(group == "High"),]# Compute networkslow.net <- NRW(low)high.net <- NRW(high)Pathfinder Network
Description
Estimates a pathfinder network using the MST-PathfinderNetwork method from Quirin et al. (2008; see also Schvaneveldt, 1990)
Usage
PF(data)Arguments
data | Matrix or data frame.A binary response matrix |
Value
An adjacency matrix
Author(s)
Alexander Christensen <alexpaulchristensen@gmail.com>
References
Quirin, A., Cordon, O., Guerrero-Bote, V. P., Vargas-Quesada, B., & Moya-Aneon, F. (2008)A quick MST-based algorithm to obtain Pathfinder networks (Inf, n-1).Journal of the American Society for Information Science and Technology,59, 1912-1924.
Schvaneveldt, R. W. (1990).Pathfinder associative networks: Studies in knowledge organization.Norwood, NJ: Ablex Publishing.
Examples
# Obtain datadata <- open.binary# Estimate networkpf.net <- PF(data)Modularity
Description
Computes a global modularity measure (Q) using the Louvain community detection algorithm
Usage
Q(A)Arguments
A | An adjacency matrix of network data |
Value
Returns Q or a measure of how well the communities in the network are compartmentalized
Author(s)
Alexander Christensen <alexpaulchristensen@gmail.com>
References
Blondel, V. D., Guillaume, J. L., Lambiotte, R., & Lefebvre, E. (2008).Fast unfolding of communities in large networks.Journal of Statistical Mechanics: Theory and Experiment,2008, P10008.
Rubinov, M., & Sporns, O. (2010). Complex network measures of brain connectivity: Uses and interpretations.NeuroImage,52, 1059-1069.
Examples
# Pearson's correlation only for CRAN checksA <- TMFG(similarity(sim.fluency(100), method = "cor"))modularity <- Q(A)Shiny App forSemNeT
Description
An interactive Shiny application for runningSemNeT analysis.
Usage
SemNeTShiny()Value
A list calledresultShiny containing:
data | The data imported into |
group | The grouping variable imported into |
network | The networks generated during |
measures | Network measures ASPL (Average Shortest Path Lengths),CC (Clustering Coefficient), and Q (Modularity) for the networks generatedduring |
(seesemnetmeas)
comparePlot | A visualization of the networks generated during |
(seecompare_nets)
randomTest | Statistical results from the Random Network Test in |
bootstrap | Results from the Bootstrap Network Analysis in |
bootstrapTest | Statistical results from the Bootstrap Network Analysis(see |
bootstrapPlot | Plots of the statistical results from the Bootstrap Network Analysis(see |
randomWalk | Results from the Random Walk Analysis(see |
bootstrapPlot | Results from the Spreading Activation Analysis(see |
Examples
if(interactive()){SemNeTShiny()}Triangulated Maximally Filtered Graph
Description
Applies the Triangulated Maximally Filtered Graph (TMFG) filtering method(Please see and cite Massara et al., 2016). The TMFG method uses a structuralconstraint that limits the number of zero-order correlations included in the network(3n - 6; wheren is the number of variables). The TMFG algorithm begins byidentifying four variables which have the largest sum of correlations to all othervariables. Then, it iteratively adds each variable with the largest sum of threecorrelations to nodes already in the network until all variables have been added tothe network. This structure can be associated with the inverse correlation matrix(i.e., precision matrix) to be turned into a GGM (i.e., partial correlation network)by usingLoGo. See Details for more information on thisnetwork estimation method.
Usage
TMFG(data, depend = FALSE)Arguments
data | Matrix or data frame.Must be a square matrix |
depend | Boolean.Is network a dependency (or directed) network?Defaults to |
Details
The TMFG method applies a structural constraint on the network,which restrains the network to retain a certain number of edges (3n-6, wherenis the number of nodes; Massara et al., 2016). The network is also composed of 3- and 4-nodecliques (i.e., sets of connected nodes; a triangle and tetrahedron, respectively). TheTMFG method constructs a network using zero-order correlations and the resulting networkcan be associated with the inverse covariance matrix(yielding a GGM; Barfuss, Massara, Di Matteo, & Aste, 2016).Notably, the TMFG can use any association measure and thus does not assume the data is multivariate normal.
Construction begins by forming a tetrahedron of the four nodes that havethe highest sum of correlations that are greater than the average correlation in thecorrelation matrix. Next, the algorithm iteratively identifies the node that maximizesits sum of correlations to a connected set of three nodes (triangles) already includedin the network and then adds that node to the network. The process is completed onceevery node is connected in the network. In this process, the network automaticallygenerates what's called a planar network. A planar network is a network that could bedrawn on a sphere with no edges crossing (often, however, the networks are depictedwith edges crossing; Tumminello, Aste, Di Matteo, & Mantegna, 2005).
Value
Returns an TMFG filtered adjacency matrix
Author(s)
Alexander Christensen <alexpaulchristensen@gmail.com>
References
Christensen, A. P., Kenett, Y. N., Aste, T., Silvia, P. J., & Kwapil, T. R. (2018).Network structure of the Wisconsin Schizotypy Scales-Short Forms: Examining psychometric network filtering approaches.Behavior Research Methods,50, 2531-2550.
Massara, G. P., Di Matteo, T., & Aste, T. (2016).Network filtering for big data: Triangulated maximally filtered graph.Journal of Complex Networks,5, 161-178.
Examples
# Pearson's correlation only for CRAN checksA <- TMFG(similarity(sim.fluency(100), method = "cor"))Frequency of Animal Responses
Description
Frequency of animal responses from Christensen & Kenett (2019). These frequenciesare used to generate data in thesim.fluency function.
Usage
data(animals.freq)Format
animals.freq (vector, length = 367)
Examples
data("animals.freq")Bootstrapped Semantic Network Analysis
Description
Bootstrap techniques to generatesemantic networks and compute global network characteristics
Usage
bootSemNeT( ..., method = c("CN", "NRW", "PF", "TMFG"), methodArgs = list(), type = c("case", "node"), prop = 0.5, sim, weighted = FALSE, iter = 1000, cores)Arguments
... | Matrices or data frames.Cleaned response matrices (e.g., |
method | Character.Network estimation method to use.Current options include: |
methodArgs | List.A list of additional arguments for the network estimation function.See links in argument |
type | Character.Type of bootstrap to perform
|
prop | Numeric.Only for |
sim | Character.Similarity measure to use.Defaults to |
weighted | Boolean.Should weighted ASPL and CC be used?Defaults to |
iter | Numeric.Number of iterations in bootstrap.Defaults to |
cores | Numeric.Number of computer processing cores to use for bootstrapping samples.Defaults ton / 2 total number of cores.Set to any number between 1 and maximum amount of cores on your computer(see |
Value
Returns a list containing:
dataMeas | A matrix for the network input in the |
dataSumm | Summary statistics across the bootrapped samples for thenetwork input in the |
prop | Outputs the proportion used from the |
iter | Outputs the number of bootstrapped samplesused from the |
If apaired network is input, then also returns:
pairedMeas | A matrix for the network input in the |
pairedSumm | Summary statistics across the bootrapped samples for thenetwork input in the |
Author(s)
Alexander Christensen <alexpaulchristensen@gmail.com>
Examples
# Simulate Datasetone <- sim.fluency(20)# Run bootstrap node-drop (partial) networksone.result <- bootSemNeT(one, prop = .50, iter = 100,sim = "cosine", cores = 2, method = "TMFG", type = "node")# Run bootstrap case-drop networks## Includes additional equating argument: minCaseone.result <- bootSemNeT(one, iter = 100, sim = "cosine",cores = 2, method = "TMFG", type = "case", methodArgs = list(minCase = 2))# Bootstrap case-wise networks## Get openness datalow <- open.clean[which(open.group == "Low"),]high <- open.clean[which(open.group == "High"),]## Run### Inlcudes additional NRW argument: thresholdopen <- bootSemNeT(low, high, iter = 100, cores = 2, method = "NRW", type = "case",methodArgs = list(type = "num", threshold = 3))Plots Networks for Comparison
Description
Usesqgraph to plot networks.Accepts any number of networks and will organize the plotsin the number of side-by-side columns using the heuristic of taking the square root of the number ofinput and rounding down to the nearest integer (i.e.,floor(sqrt(length(input)))).
Examples
3 networks: 1 x 3
6 networks: 2 x 3
9 networks: 3 x 3
Usage
compare_nets( ..., title, config, placement = c("match", "default"), weighted = FALSE, qgraph.args = list())Arguments
... | Matrices or data frames of network adjacency matrices |
title | List.Characters denoting titles of plots |
config | Character.Defaults to |
placement | Character.How should nodes be placed when comparing groups?Defaults to
|
weighted | Boolean.Should networks be plotted with weights?Defaults to |
qgraph.args | List.An argument list to be passed onto |
Value
Plots networks usingqgraph
Author(s)
Alexander Christensen <alexpaulchristensen@gmail.com>
References
Epskamp, S., Cramer, A. O. J., Waldorp, L. J., Schmittmann, V. D., & Borsboom, D. (2012).qgraph: Network visualizations of relationships in psychometric data.Journal of Statistical Software,48, 1-18.
Jones, P. J. (2019).networktools: Tools for Identifying Important Nodes in Networks.R package version 1.2.1.
Jones, P. J., Mair, P., & McNally, R. (2018).Visualizing psychological networks: A tutorial in R.Frontiers in Psychology,9, 1742.
Examples
# Simulate Datasetsone <- sim.fluency(10)two <- sim.fluency(10)# Compute similarity matrixcos1 <- similarity(one, method = "cosine")cos2 <- similarity(two, method = "cosine")# Compute networksnet1 <- TMFG(cos1)net2 <- TMFG(cos2)# Compare networkscompare_nets(net1, net2, title = list("One", "Two"), config = "spring")# Change edge colorscompare_nets(net1, net2, title = list("One", "Two"),config = "spring", qgraph.args = list(edge.color = "blue"))Convert Adjacency Matrix to Cytoscape Format
Description
Converts an adjacency matrix to Cytoscape's sparse matrix format
Usage
convert2cytoscape(A)Arguments
A | Matrix or data frame.A cleaned, finalized response matrix ready to be visualized |
Value
A sparse matrix formatted for Cytoscape
Author(s)
Alexander Christensen <alexpaulchristensen@gmail.com>
References
Shannon, P., Markiel, A., Ozier, O., Baliga, N. S., Wang, J. T., Ramage, D., ... & Ideker, T. (2003).Cytoscape: A software environment for integrated models of biomolecular interaction networks.Genome Research,13, 2498-2504.
Examples
# Simulate Datasetsone <- sim.fluency(10)two <- sim.fluency(10)# Compute similarity matrixcos1 <- similarity(one, method = "cosine")cos2 <- similarity(two, method = "cosine")# Compute networksnet1 <- TMFG(cos1)net2 <- TMFG(cos2)# Convert to Cytoscape formatcyto1 <- convert2cytoscape(net1)cyto2 <- convert2cytoscape(net2)# Write to .csvwrite.csv(cyto1, file.path(tempdir(), "cyto1.csv"), row.names = FALSE)write.csv(cyto2, file.path(tempdir(), "cyto2.csv"), row.names = FALSE)Convert Network(s) to igraph's Format
Description
Converts single or multiple networks intoigraph's format for network analysis
Usage
convert2igraph(A, neural = FALSE)Arguments
A | Adjacency matrix (network matrix) or brain connectivity array(from |
neural | Defunct. |
Value
Returns a network matrix inigraph's format
Author(s)
Alexander Christensen <alexpaulchristensen@gmail.com>
Examples
# Pearson's correlation only for CRAN checksA <- TMFG(similarity(sim.fluency(50), method = "cor"))igraphNetwork <- convert2igraph(A)Equate Groups
Description
A function to "equate" multiple response matrices to one another.N number of groups are matched based on their responses sothat every group has the same responses in their data
Usage
equate(...)Arguments
... | Matrices, data frames or a list of matrices and data frames.Binary response matrices to be equated |
Value
This function returns a list containing theequated binary response matrices in the order they were input.The response matrices are labeled as the object name they wereentered with
Author(s)
Alexander Christensen <alexpaulchristensen@gmail.com>
Examples
# Obtain binary databin <- open.binary# Finalize mat1mat1 <- finalize(bin[c(1:5),])# Finalize mat2mat2 <- finalize(bin[c(6:10),])# Equate mat1 and mat1eq <- equate(mat1, mat2)# Obtain respective equated response matriceseq.mat1 <- eq$mat1 # list objects are named with the nameseq.mat2 <- eq$mat2 # they were entered withFinalize Response Matrix
Description
Finalizes the response matrix by keepingresponses that are given by a certain number of people
Usage
finalize(rmat, minCase = 2)Arguments
rmat | Binary matrix.Atextcleaner filtered response matrix |
minCase | Numeric.Minimum number of cases to produce a response |
Value
A binary response matrix with responsesgiven by at leastminCase people
Author(s)
Alexander Christensen <alexpaulchristensen@gmail.com>
Examples
# Obtain binary databin <- open.binary# Finalize mat1mat1 <- finalize(bin)High Openness to Experience Network
Description
High openness to experience network from Christensen & Kenett (2019)
Usage
data(net.high)Format
net.high (matrix, 160 x 160)
References
Christensen, A. P., & Kenett, Y. N. (2019)Semantic network analysis (SemNA): A tutorial on preprocessing, estimating, and analyzing semantic networks.PsyArXiv.
Examples
data("net.high")Low Openness to Experience Network
Description
Low openness to experience network from Christensen & Kenett (2019)
Usage
data(net.low)Format
net.low (matrix, 160 x 160)
References
Christensen, A. P., & Kenett, Y. N. (2019)Semantic network analysis (SemNA): A tutorial on preprocessing, estimating, and analyzing semantic networks.PsyArXiv.
Examples
data("net.low")Simulated Result for Dataset One
Description
A result ofbootSemNeT from a simulated dataset
Usage
data(one.result)Format
one.result (list, length = 4)
Examples
data("one.result")Binary response Matrices (Openness and Verbal Fluency)
Description
Binary response matrices for the Animals verbal fluency data (n = 516)from Christensen et al. (2018).
Usage
data(open.binary)Format
open.binary (matrix, 516 x 367)
References
Christensen, A. P., Kenett, Y. N., Cotter, K. N., Beaty, R. E., & Silvia, P. J. (2018).Remotely close associations: Openness to experience and semantic memory structure.European Journal of Personality,32, 480-492.
Examples
data("open.binary")Cleaned response Matrices (Openness and Verbal Fluency)
Description
Cleaned response matrices for the Animals verbal fluency data (n = 516)from Christensen et al. (2018).
Usage
data(open.clean)Format
open.clean (matrix, 516 x 35)
References
Christensen, A. P., Kenett, Y. N., Cotter, K. N., Beaty, R. E., & Silvia, P. J. (2018).Remotely close associations: Openness to experience and semantic memory structure.European Journal of Personality,32, 480-492.
Examples
data("open.clean")Groups for Openness and Verbal Fluency
Description
Groups for the Animals verbal fluency data (n = 516)from Christensen et al. (2018; see alsoopen.clean).
Usage
data(open.group)Format
open.group (vector, length = 516)
References
Christensen, A. P., Kenett, Y. N., Cotter, K. N., Beaty, R. E., & Silvia, P. J. (2018).Remotely close associations: Openness to experience and semantic memory structure.European Journal of Personality,32, 480-492.
Examples
data("open.group")Animate Networks for Spreading Activation from Shiny
Description
Usesqgraph andani.recordto animate networks. Accepts only one network animation at a time
Usage
## S3 method for class 'animateShiny'plot(x, ...)Arguments
x | Shiny result |
... | Additional arguments for |
Value
Plots animated networks usingqgraph andani.record
Author(s)
Alexander Christensen <alexpaulchristensen@gmail.com>
References
Epskamp, S., Cramer, A. O. J., Waldorp, L. J., Schmittmann, V. D., & Borsboom, D. (2012).qgraph: Network visualizations of relationships in psychometric data.Journal of Statistical Software,48, 1-18.Retrieved from: http://www.jstatsoft.org/v48/i04/
Siew, C. S. Q. (2019).spreadr: An R package to simulate spreading activation in a network.Behavior Research Methods,51, 910-929.https://doi.org/10.3758/s13428-018-1186-5
Examples
if(interactive()){SemNeTShiny()}## Not run: plot(resultShiny$spreadingActivationPlot[[1]])## End(Not run)Plot forbootSemNeT
Description
Plots output frombootSemNeT
Usage
## S3 method for class 'bootSemNeT'plot(..., groups = NULL, measures = c("ASPL", "CC", "Q"))Arguments
... | Object(s) from |
groups | Character.Labels for groups in the order they were enteredin |
measures | Character.Measures to be plotted |
Value
Returns plots for the specified measures
Author(s)
Alexander Christensen <alexpaulchristensen@gmail.com>
Examples
# Simulate Datasetone <- sim.fluency(20)# Run partial bootstrap networksone.result <- bootSemNeT(one, prop = .50, iter = 1000,sim = "cosine", cores = 2, type = "node", method = "TMFG")# Plotplot(one.result, groups = c("One"))Plots Networks for Comparison from Shiny
Description
Usesqgraphto plot networks. Accepts any number of networks and will organize the plotsin the number of side-by-side columns using the heuristic of taking the square root of the number ofinput and rounding down to the nearest integer (i.e.,floor(sqrt(length(input)))).Performs the same operations ascompare_nets
Examples
3 networks: 1 x 3
6 networks: 2 x 3
9 networks: 3 x 3
Usage
## S3 method for class 'compareShiny'plot(x, ...)Arguments
x | Shiny result |
... | Additional arguments |
Value
Plots networks usingqgraph
Author(s)
Alexander Christensen <alexpaulchristensen@gmail.com>
References
Epskamp, S., Cramer, A. O. J., Waldorp, L. J., Schmittmann, V. D., & Borsboom, D. (2012).qgraph: Network visualizations of relationships in psychometric data.Journal of Statistical Software,48, 1-18.
Jones, P. J. (2019).networktools: Tools for Identifying Important Nodes in Networks.R package version 1.2.1.
Jones, P. J., Mair, P., & McNally, R. (2018).Visualizing psychological networks: A tutorial in R.Frontiers in Psychology,9, 1742.
Examples
# Simulate Datasetsone <- sim.fluency(10)two <- sim.fluency(10)# Compute similarity matrixcos1 <- similarity(one, method = "cosine")cos2 <- similarity(two, method = "cosine")# Compute networksnet1 <- TMFG(cos1)net2 <- TMFG(cos2)# Compare networkscompare_nets(net1, net2, title = list("One", "Two"), config = "spring")# Change edge colorscompare_nets(net1, net2, title = list("One", "Two"),config = "spring", qgraph.args = list(edge.color = "blue"))Test Against Random Networks
Description
Performs significance tests for global measuresof semantic networks against the global measures of equivalentsize (and density) random networks
Usage
randnet.test(..., iter, cores)Arguments
... | Matrices or data frames.Semantic networks to be compared against random networks |
iter | Numeric.Number of iterations in bootstrap.Defaults to |
cores | Number of computer processing cores to use for bootstrapping samples.Defaults ton - 1 total number of cores.Set to any number between 1 and maximum amount of cores on your computer |
Value
Returns a matrix containing p-valuesfor the network measures of the input networks againstthe distribution of equivalent random networks. The lasttwo columns contain the mean ("M.rand") andstandard deviation ("SD.rand") of the network measuresfor the random network distribution
Author(s)
Alexander Christensen <alexpaulchristensen@gmail.com>
References
Viger, F., & Latapy, M. (2016).Efficient and simple generation of random simple connected graphs with prescribed degree sequence.Journal of Complex Networks,4, 15-37.
Examples
# Get openness dataone <- open.clean[which(open.group == "Low"),]two <- open.clean[which(open.group == "High"),]# Compute networksnet.one <- CN(one)net.two <- CN(two)# Perform random networks testrandnet.test(net.one, net.two, iter = 100, cores = 2)Random Walk Simulation
Description
Simulates random walks over two networks to examine the characteristicsof spontaneous spreading activation (see Kenett & Austerweil, 2016)
Usage
randwalk(A, B, reps = 20, steps = 10, iter = 10000, cores)Arguments
A | Matrix or data frame.Adjacency matrix of a semantic network |
B | Matrix or data frame.A comparison adjacency matrix of a semantic network |
reps | Numeric.Number of repetitions of increments in 10 steps.Defaults to |
steps | Numeric.Number of random steps to begin with.Defaults to |
iter | Numeric.Number of iterations for each random walk.Defaults to |
cores | Numeric.Number of computer processing cores to use for bootstrapping samples.Defaults ton - 1 total number of cores.Set to any number between 1 and maximum amount of cores on your computer |
Value
A result matrix containing the means and standard deviations forseveral measures as well asp-values for a Mann-Whitney U test
Author(s)
Alexander Christensen <alexpaulchristensen@gmail.com> and Yoed Kenett <yoedkenett@gmail.com>
References
Kenett, Y. N., & Austerweil, J. L. (2016).Examining search processes in low and high creative individuals with random walks.InPaper presented at the proceedings of the 38th annual meeting of the cognitive science society. Austin, TX.
Examples
# Simulate Datasetsone <- sim.fluency(10)two <- sim.fluency(10)# Compute similarity matrixcos1 <- similarity(one, method = "cosine")cos2 <- similarity(two, method = "cosine")# Compute networksnet1 <- TMFG(cos1)net2 <- TMFG(cos2)# Run random walk analysisrw.results <- randwalk(net1, net2, iter = 100, cores = 2)Response Analysis
Description
Computes the difference in the total and uniquenumber of responses between two groups (follows Christensen et al., 2018)
Usage
response.analysis(...)Arguments
... | Matrix or data frame.Responses matrices for two different groups |
Value
A list containing objects:
total | A vector with the total responses given by each participant. At-testis used to compare, on average, whether one group provides more responsethan the other |
unique | A vector with the number of unique responses provided by both groups( |
Author(s)
Alexander Christensen <alexpaulchristensen@gmail.com>
References
Christensen, A. P., Kenett, Y. N., Cotter, K. N., Beaty, R. E., & Silvia, P. J. (2018).Remotely close associations: Openness to experience and semantic memory structure.European Journal of Personality,32, 480-492.
Examples
# Obtain datalow <- open.clean[which(open.group == "Low"),]high <- open.clean[which(open.group == "High"),]# Perform analysisresponse.analysis(low, high)Semantic Network Measures
Description
Computes the average shortest path length (ASPL),clustering coefficient(CC), and modularity (Q) of the network
Usage
semnetmeas(A, meas = c("ASPL", "CC", "Q"), weighted = FALSE)Arguments
A | Matrix or data frame.An adjacency matrix of a network |
meas | Character.Global network measures to compute.By default, computes ASPL, CC, and Q.Individual measures can be selected |
weighted | Boolean.Should weighted measures be computed?Defaults to |
Value
Returns a values for ASPL, CC, and Q
Author(s)
Alexander Christensen <alexpaulchristensen@gmail.com>
Examples
# Simulate Datasetsone <- sim.fluency(10)# Compute similarity matrixcos <- similarity(one, method = "cosine")# Compute networksnet <- TMFG(cos)# Compute global network measuresglobmeas <- semnetmeas(net)Simulates a verbal fluency binary response matrix
Description
Simulates verbal fluency data based on the number ofnodes in the desired network. The summed total ofeach response is simulated from a poisson distribution (seerpois), using frequencies from theanimals.freq data. Using thesesums, participants responses are simulated with a probability of givinga response as the total of the summed response over the number of participants.
Usage
sim.fluency(nodes, cases, random = FALSE)Arguments
nodes | Numeric.Number of nodes to simulate in data.Defaults to |
cases | Numeric.Number of participants to simulate in data.Defaults to |
random | Boolean.Should the frequencies be randomly sampled from?Defaults to |
Value
A binary matrix withp (participants) byn (nodes)
Author(s)
Alexander Christensen <alexpaulchristensen@gmail.com>
Examples
# Simulate data for 50 nodes and 200 participantssim.fluency(nodes = 50, cases = 200)Measures of Similarity
Description
Computes several measures of similarity(see Choi, Cha, & Tappert, 2010 for additional measures)
Usage
similarity( data, method = c("angular", "cor", "cosine", "euclid", "faith", "jaccard", "phi", "rr"))Arguments
data | Matrix or data frame.A binarized dataset of verbal fluency or linguistic data | ||||||||||||||||||||||||||
method | Character.Type of similarity measure to compute. Below are the definitions for each bin:
Options include:
|
Value
A symmetric similarity matrix
Author(s)
Alexander Christensen <alexpaulchristensen@gmail.com>
References
Choi, S. S., Cha, S. H., & Tappert, C. C. (2010).A survey of binary similarity and distance measures.Journal of Systemics, Cybernetics and Informatics,8, 43-48.
Examples
# Simulate Datasetsone <- sim.fluency(10)# Compute similarity matrixcos <- similarity(one, method = "cosine")Statistical tests forbootSemNeT
Description
Computes statistical tests for bootstrappednetworks frombootSemNeT
Usage
test.bootSemNeT( ..., test = c("ANCOVA", "ANOVA", "t-test"), measures = c("ASPL", "CC", "Q"), formula = NULL, groups = NULL)Arguments
... | Object(s) from |
test | Character.Type of statistical test to be used. |
measures | Character.Network measures to be tested. |
formula | Character.A formula for specifying an ANOVA structure. The formula shouldhave the predictor variable as "y" and include the names the variablesare grouped by (e.g., |
groups | Data frame.A data frame specifying the groups to be input into the formula.The column names should be the variable names of interest. Thegroups should be in the same order as the groups input into |
Value
Returns a list containing the objects:
ASPL | Test statistics for each proportion of nodes remaining for ASPL |
CC | Test statistics for each proportion of nodes remaining for CC |
Q | Test statistics for each proportion of nodes remaining for Q |
If two groups:
A matrix in each object has the following columns:
t-statistic | Statistic from the |
df | Degrees of freedom |
p-value | p-value with values equal to |
d | Cohen'sd |
CI95.lower | Lower bound of the 95 percent confidence interval |
CI95.upper | Upper bound of the 95 percent confidence interval |
Direction | Direction of the effect. The argument |
Row names refer to the proportion of nodes remaining in bootstrapped networks
If three or more groups:
A list containing two objects:
ANOVA | A matrix containing theF-statistic, group degrees of freedom,residual degrees of freedom,p-value, and partial eta squared |
HSD | A matrix containing the differences between each group ( |
Author(s)
Alexander Christensen <alexpaulchristensen@gmail.com>
Examples
# Simulate Datasetone <- sim.fluency(20)two <- sim.fluency(20)# Run partial bootstrap networkstwo.result <- bootSemNeT(one, two, prop = .50, iter = 100,sim = "cosine", cores = 2, type = "node", method = "TMFG")# Compute teststest.bootSemNeT(two.result)# Two-way ANOVA example## Simulated datahihi <- sim.fluency(50, 500)hilo <- sim.fluency(50, 500)lohi <- sim.fluency(50, 500)lolo <- sim.fluency(50, 500)## Create groupsgroups <- matrix(c("high", "high","high", "low","low", "high","low", "low"), ncol = 2, byrow = TRUE)## Change column names (variable names)colnames(groups) <- c("gf","caq")## Run partial bootstrap networksboot.fifty <- bootSemNeT(hihi, hilo, lohi, lolo, prop = .50,type = "node", method = "TMFG", cores = 2, iter = 100)boot.sixty <- bootSemNeT(hihi, hilo, lohi, lolo, prop = .60,type = "node", method = "TMFG", cores = 2, iter = 100)## Compute teststest.bootSemNeT(boot.fifty, boot.sixty,test = "ANOVA", formula = "y ~ gf*caq", groups = groups)Simulated Result for Dataset One and Two
Description
A result ofbootSemNeT from two simulated datasets
Usage
data(two.result)Format
two.result (list, length = 6)
Examples
data("two.result")Plots for Vignette
Description
Plots for vignette taken from Christensen & Kenett (2019)
Usage
data(vignette.plots)Format
vignette.plots (list, length = 3)
References
Christensen, A. P., & Kenett, Y. N. (2019)Semantic network analysis (SemNA): A tutorial on preprocessing, estimating, and analyzing semantic networks.PsyArXiv.
Examples
data("vignette.plots")