Learn R Programming

manynet (version 0.1.1)

miss: Tools for imputing missing tie data

Description

These functions offer tools for imputing missing tie data. Currently two options are available: replacing the missing values with zeros, which are the modal value in sparse social networks, and replacing the missing values with the average non-missing value for that vector.

Usage

na_to_zero(.data)

na_to_mean(.data)

Value

A data object of the same class as the function was given.

Arguments

.data

An object of a manynet-consistent class:

  • matrix (adjacency or incidence) from {base} R

  • edgelist, a data frame from {base} R or tibble from {tibble}

  • igraph, from the {igraph} package

  • network, from the {network} package

  • tbl_graph, from the {tidygraph} package

Functions

  • na_to_zero(): Impute missing tie data as zero, the modal value in sparse social networks.

  • na_to_mean(): Impute missing tie data as the mean value in the network.

References

Krause, Robert, Mark Huisman, Christian Steglich, and Tom A.B. Snijders. 2020. "Missing data in cross-sectional networks–An extensive comparison of missing data treatment methods". Social Networks, 62, 99-112.

See Also

Other manipulations: add, from, reformat, split(), tidy, transform()

Examples

Run this code
missTest <- ison_adolescents %>% 
   add_tie_attribute("weight", c(1,NA,NA,1,1,1,NA,NA,1,1)) %>% 
   as_matrix
missTest
na_to_zero(missTest)
na_to_mean(missTest)

Run the code above in your browser using DataLab