bootnet | R Documentation |

Implements the bootstrapping method described in Snijders and Borgatti (1999).
This function is essentially a wrapper of `boot`

.

```
resample_graph(graph, self = NULL, useR = FALSE, ...)
bootnet(graph, statistic, R, resample.args = list(self = FALSE), ...)
## S3 method for class 'diffnet_bootnet'
c(..., recursive = FALSE)
## S3 method for class 'diffnet_bootnet'
print(x, ...)
## S3 method for class 'diffnet_bootnet'
hist(
x,
main = "Empirical Distribution of Statistic",
xlab = expression(Values ~ of ~ t),
breaks = 20,
annotated = TRUE,
b0 = expression(atop(plain("") %up% plain("")), t[0]),
b = expression(atop(plain("") %up% plain("")), t[]),
ask = TRUE,
...
)
## S3 method for class 'diffnet_bootnet'
plot(x, y, ...)
```

`graph` |
Any class of accepted graph format (see |

`self` |
Logical scalar. When |

`useR` |
Logical scalar. When |

`...` |
Further arguments passed to the method (see details). |

`statistic` |
A function that returns a vector with the statistic(s) of interest. The first argument must be the graph, and the second argument a vector of indices (see details) |

`R` |
Number of reps |

`resample.args` |
List. Arguments to be passed to |

`recursive` |
Ignored |

`x` |
A |

`main` |
Character scalar. Title of the histogram. |

`xlab` |
Character scalar. x-axis label. |

`breaks` |
Passed to |

`annotated` |
Logical scalar. When TRUE marks the observed data average and the simulated data average. |

`b0` |
Character scalar. When |

`b` |
Character scalar. When |

`ask` |
Logical scalar. When |

`y` |
Ignored. |

Just like the `boot`

function of the boot package, the `statistic`

that is passed must have as arguments the original data (the graph in this case),
and a vector of indicides. In each repetition, the graph that is passed is a
resampled version generated as described in Snijders and Borgatti (1999).

When `self = FALSE`

, for pairs of individuals that haven been drawn more than
once the algorithm, in particular, `resample_graph`

, takes care of filling
these pseudo autolinks that are not in the diagonal of the network. By default
it is assumed that these pseudo-autolinks depend on whether the original graph
had any, hence, if the diagonal has any non-zero value the algorithm assumes that
`self = TRUE`

, skiping the 'filling algorithm'. It is important to notice
that, in order to preserve the density of the original network, when
assigning an edge value to a pair of the form `(i,i)`

(pseudo-autolinks),
such is done with probabilty proportional to the density of the network, in
other words, before choosing from the existing list of edge values, the
algorithm decides whether to set a zero value first.

The vector of indices that is passed to `statistic`

, an integer vector with range
1 to `n`

, corresponds to the drawn sample of nodes, so the user can, for
example, use it to get a subset of a `data.frame`

that will be used with
the `graph`

.

The 'plot.diffnet_bootnet' method is a wrapper for the 'hist' method.

A list of class `diffnet_bootnet`

containing the following:

`graph` |
The graph passed to |

`p.value` |
The resulting p-value of the test (see details). |

`t0` |
The observed value of the statistic. |

`mean_t` |
The average value of the statistic applied to the simulated networks. |

`var_t` |
A vector of length |

`R` |
Number of simulations. |

`statistic` |
The function |

`boot` |
A |

`resample.args` |
The list |

Snijders, T. A. B., & Borgatti, S. P. (1999). Non-Parametric Standard Errors and Tests for Network Statistics. Connections, 22(2), 1–10. Retrieved from https://www.stats.ox.ac.uk/~snijders/Snijders_Borgatti.pdf

Other Functions for inference:
`moran()`

,
`struct_test()`

```
# Computing edgecount -------------------------------------------------------
set.seed(13)
g <- rgraph_ba(t=99)
ans <- bootnet(g, function(w, ...) length(w@x), R=100)
ans
# Generating
```

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.