You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Besides of the usual parameters passed to `rdiffnet`, the `rdiffnet_multiple` function requires `R` (number of repetitions/simulations), and `statistic` (a function that returns the statistic of insterst). Optionally, the user may choose to specify the number of clusters to run it in parallel (multiple CPUs):
boxplot(ans_1and2, col="ivory", xlab = "Time", ylab = "Proportion of Adopters")
244
+
boxplot(ans_2and3, col="tomato", add=TRUE)
245
+
boxplot(ans_1and3, col = "steelblue", add=TRUE)
246
+
legend(
247
+
"topleft",
248
+
fill = c("ivory", "tomato", "steelblue"),
249
+
legend = c("1/2", "2/3", "1/3"),
250
+
title = "Threshold range",
251
+
bty ="n"
252
+
)
253
+
```
254
+
255
+
256
+
* Example simulating a thousand networks by changing threshold levels.
257
+
The final prevalence, or hazard as a function of threshold levels.
258
+
259
+
# Problems
260
+
261
+
1. Given the following types of networks: Small-world, Scale-free, Bernoulli,
262
+
what set of $n$ initiators maximizes diffusion?
263
+
(<ahref="sim-solutions.r"target="_blank">solution script</a> and <ahref="sim-solutions.png"target="_blank">solution plot</a>)
264
+
265
+
# Appendix
177
266
267
+
The following is example code that can be used to run multiple simulations like it is done using the `rdiffnet_multiple` function. We do not recommend this approach but it may be useful for some users:
This can actually be simplified by using the function `rdiffnet_multiple`. The following lines of code accomplish the same as the previous code avoiding the for-loop (from the user's perspective). Besides of the usual parameters passed to `rdiffnet`, the `rdiffnet_multiple` function requires `R` (number of repetitions/simulations), and `statistic` (a function that returns the statistic of insterst). Optionally, the user may choose to specify the number of clusters to run it in parallel (multiple CPUs):
- This is, if for example time of adoption is independent on the structure of the network, then the average threshold level will be independent from the network structure as well.
81
-
82
-
- Another way of looking at this is that the test will allow us to see how probable is to have this combination of network structure and network threshold (if it is uncommon then we say that the diffusion model is highly likely)
83
-
84
-
85
-
## Example Not random TOA
86
-
87
-
- To use this test, __netdiffuseR__ has the `struct_test` function.
88
-
- Basically it simulates networks with the same density and computes a particular statistic every time, generating an EDF (Empirical Distribution Function) under the Null hyphothesis (p-values).
89
-
90
-
```{r Struct non-random-toa, cache=TRUE}
91
-
# Simulating network
92
-
set.seed(1123)
93
-
net <- rdiffnet(n=500, t=10, seed.graph = "small-world")
- This is, if for example time of adoption is independent on the structure of the network, then the average threshold level will be independent from the network structure as well.
235
+
236
+
- Another way of looking at this is that the test will allow us to see how probable is to have this combination of network structure and network threshold (if it is uncommon then we say that the diffusion model is highly likely)
237
+
238
+
239
+
### Example Not random TOA
240
+
241
+
-To use this test, __netdiffuseR__ has the `struct_test` function.
242
+
-Basically it simulates networks with the same density and computes a particular statistic every time, generating an EDF (Empirical Distribution Function) under the Null hyphothesis (p-values).
243
+
244
+
```{r Struct non-random-toa, cache=TRUE}
245
+
# Simulating network
246
+
set.seed(1123)
247
+
net <- rdiffnet(n=500, t=10, seed.graph = "small-world")
0 commit comments