Skip to content

Commit

Permalink
Updated tests documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
jhollway committed Jan 25, 2024
1 parent dfa5118 commit 3346fb1
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 26 deletions.
6 changes: 4 additions & 2 deletions R/measure_diffusion.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# net_diffusion ####

#' Diffusion metrics for networks
#' Measures of network diffusion
#' @description
#' These functions allow measurement of various features of
#' a diffusion process:
Expand All @@ -17,6 +17,7 @@
#' to be protected through vaccination, isolation, or recovery for herd immunity to be reached.
#' - `network_hazard()` measures the hazard rate or instantaneous probability that
#' nodes will adopt/become infected at that time
#'
#' @param diff_model A valid network diffusion model,
#' as created by `as_diffusion()` or `play_diffusion()`.
#' @family measures
Expand Down Expand Up @@ -199,7 +200,7 @@ network_hazard <- function(diff_model){

# node_diffusion ####

#' Diffusion metrics for nodes
#' Measures of nodes in a diffusion
#' @description
#' These functions allow measurement of various features of
#' a diffusion process:
Expand All @@ -215,6 +216,7 @@ network_hazard <- function(diff_model){
#' a given mark
#' - `node_is_exposed()`: Marks the nodes that are susceptible,
#' i.e. are in the immediate neighbourhood of given mark vector
#'
#' @inheritParams cohesion
#' @inheritParams net_diffusion
#' @family measures
Expand Down
1 change: 1 addition & 0 deletions R/model_regression.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#' Linear and logistic regression for network data
#'
#' @description
#' This function provides an implementation of
#' the multiple regression quadratic assignment procedure (MRQAP)
#' for both one-mode and two-mode network linear models.
Expand Down
23 changes: 15 additions & 8 deletions R/model_tests.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
#' Conditional uniform graph and permutation tests
#'
#' These functions conduct conditional uniform graph (CUG)
#' or permutation (QAP) tests of any graph-level statistic.
#' @description
#' These functions conduct tests of any network-level statistic:
#'
#' - `test_random()` performs a conditional uniform graph (CUG) test
#' of a measure against a distribution of measures on random networks
#' of the same dimensions.
#' - `test_permutation()` performs a quadratic assignment procedure (QAP) test
#' of a measure against a distribution of measures on permutations
#' of the original network.
#' - `test_gof()` performs a chi-squared test on the squared Mahalanobis distance
#' between a diff_model and diff_models objects.
#'
#' @name tests
#' @inheritParams regression
#' @family models
Expand All @@ -10,8 +20,7 @@
#' e.g. the name of the attribute.
NULL

#' @describeIn tests Returns test results for some measure on an object
#' against a distribution of measures on random networks of the same dimensions
#' @rdname tests
#' @examples
#' marvel_friends <- to_unsigned(ison_marvel_relationships)
#' marvel_friends <- to_giant(marvel_friends) %>%
Expand Down Expand Up @@ -62,8 +71,7 @@ test_random <- function(.data, FUN, ...,
class(out) <- "network_test"
out
}
#' @describeIn tests Returns test results for some measure on an object
#' against a distribution of measures on permutations of the original network
#' @rdname tests
#' @examples
#' (qaptest <- test_permutation(marvel_friends,
#' network_heterophily, attribute = "Attractive",
Expand Down Expand Up @@ -161,8 +169,7 @@ plot.network_test <- function(x, ...,
color="red", linewidth=1.2) + ggplot2::ylab("Density")
}

#' @describeIn tests Returns the squared Mahalanobis distance
#' and chi-squared results for diff_model and diff_models objects
#' @rdname tests
#' @param diff_model A diff_model object is returned by
#' `play_diffusion()` or `as_diffusion()` and contains
#' a single empirical or simulated diffusion.
Expand Down
2 changes: 1 addition & 1 deletion man/net_diffusion.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/node_diffusion.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 11 additions & 14 deletions man/tests.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 3346fb1

Please sign in to comment.