Title: | Strategic Players |
---|---|
Description: | Identifies individuals in a social network who should be the intervention subjects for a network intervention in which you have a group of targets, a group of avoiders, and a group that is neither. |
Authors: | Miles Ott |
Maintainer: | Miles Ott <[email protected]> |
License: | GPL-3 |
Version: | 1.1 |
Built: | 2025-03-07 02:47:18 UTC |
Source: | https://github.com/milesott/strategicplayers |
Identifies individuals in a social network who should be the intervention subjects for a network intervention in which you have a group of targets, a group of avoiders, and a group that is neither.
The DESCRIPTION file:
Package: | strategicplayers |
Type: | Package |
Title: | Strategic Players |
Version: | 1.1 |
Date: | 2024-02-10 |
Author: | Miles Ott |
Maintainer: | Miles Ott <[email protected]> |
Description: | Identifies individuals in a social network who should be the intervention subjects for a network intervention in which you have a group of targets, a group of avoiders, and a group that is neither. |
License: | GPL-3 |
RoxygenNote: | 5.0.1 |
Repository: | https://milesott.r-universe.dev |
RemoteUrl: | https://github.com/milesott/strategicplayers |
RemoteRef: | HEAD |
RemoteSha: | f00993adba92383c1b3712846a965c4f17e78241 |
Index of help topics:
distance distance sp sp strategicplayers-package Strategic Players
use the sp function to get a list of strategic players indicies
Miles Ott
Maintainer: Miles Ott <[email protected]>
https://www.ncbi.nlm.nih.gov/pmc/articles/PMC6959850/
#I am commenting this all out so that the package won't require sna any more :) #require(sna) #generate a bernoulli random network on 20 nodes #network<-rgraph(20, tprob=.2) #get the geodesic distances of the network #geo<-geodist(network)[2]$gdist #defining the target group #targets<-1:10 #defining the avoidance group #avoids<-11:14 #defining the theta parameter #theta<-.8 #find sp set of size 4 #spset<-sp(4, geo, targets, avoids, theta, n.loops=100) #spset #calculates distance metric for spset #distance(geo, targets, avoids, theta, spset) #plot the network with the strategic player set highlighted in yellow #colors<-rep("white", 20) #colors[targets]<-"green" #colors[avoids]<-"red" #colors[spset]<-"yellow" #par(mar=c(1,1,1,1)) #gplot(network, vertex.col=colors, #usearrows=FALSE, edge.col="grey", #vertex.border="grey", vertex.cex=1.7, pad=0, label=1:dim(network)[1])
#I am commenting this all out so that the package won't require sna any more :) #require(sna) #generate a bernoulli random network on 20 nodes #network<-rgraph(20, tprob=.2) #get the geodesic distances of the network #geo<-geodist(network)[2]$gdist #defining the target group #targets<-1:10 #defining the avoidance group #avoids<-11:14 #defining the theta parameter #theta<-.8 #find sp set of size 4 #spset<-sp(4, geo, targets, avoids, theta, n.loops=100) #spset #calculates distance metric for spset #distance(geo, targets, avoids, theta, spset) #plot the network with the strategic player set highlighted in yellow #colors<-rep("white", 20) #colors[targets]<-"green" #colors[avoids]<-"red" #colors[spset]<-"yellow" #par(mar=c(1,1,1,1)) #gplot(network, vertex.col=colors, #usearrows=FALSE, edge.col="grey", #vertex.border="grey", vertex.cex=1.7, pad=0, label=1:dim(network)[1])
Takes in the geodesic distances, targets, avoiders, a parameter that prioritizes avoiding vs targetting, and the current players and returns the strategic players distance metric
distance(gd, targets, avoiders, theta, players)
distance(gd, targets, avoiders, theta, players)
gd |
a matrix of geodesic distances for the network of interest |
targets |
a vector of indicies of the people you want to spread the intervention to |
avoiders |
a vector of indicies of the people you don't want to spread the intervention to |
theta |
a number between 0 and 1 which weights the distance metric, 1 only prioritizes closeness to targets, 0 only prioritizes maximizing distance from avoiders |
players |
the indicies of people who you have chosen for the intervention (a subset of targets) |
returns the distance metric for strategic players, which we want to maximize
Takes in the number of intervention subjects you wish to identify, geodesic distances, targets, avoiders, and a parameter that prioritizes avoiding vs targetting, and returns the indecies of the strategic players
sp(n.players, gd, targets, avoiders, theta = 0.5, n.loops = 1000)
sp(n.players, gd, targets, avoiders, theta = 0.5, n.loops = 1000)
n.players |
the number of intervention subjects you wish to identify |
gd |
a matrix of geodesic distances for the network of interest |
targets |
a vector of indicies of the people you want to spread the intervention to |
avoiders |
a vector of indicies of the people you don't want to spread the intervention to |
theta |
a number between 0 and 1 which weights the distance metric, 1 only prioritizes closeness to targets, 0 only prioritizes maximizing distance from avoiders. Any number between 0 and 1 will be a compromise of these two goals. |
n.loops |
the number of loops to run, the more loops you run the more likely you are to identify the optimal set of strategic players |
returns the indicies for strategic players