These functions offer tools for imputing missing tie data. Currently two options are available:
na_to_zero()
replaces any missing values with zeros,
which are the modal value in sparse social networks.
na_to_mean()
replaces missing values with the average non-missing value.
na_to_zero(.data)
na_to_mean(.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
A data object of the same class as the function was given.
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.
missTest <- ison_adolescents %>%
add_tie_attribute("weight", c(1,NA,NA,1,1,1,NA,NA,1,1)) %>%
as_matrix
missTest
#> Betty Sue Alice Jane Dale Pam Carol Tina
#> Betty 0 1 0 0 0 0 0 0
#> Sue 1 0 NA 0 1 NA 0 0
#> Alice 0 NA 0 NA 1 NA 0 0
#> Jane 0 0 NA 0 1 0 0 0
#> Dale 0 1 1 1 0 0 0 0
#> Pam 0 NA NA 0 0 0 1 0
#> Carol 0 0 0 0 0 1 0 1
#> Tina 0 0 0 0 0 0 1 0
na_to_zero(missTest)
#> Betty Sue Alice Jane Dale Pam Carol Tina
#> Betty 0 1 0 0 0 0 0 0
#> Sue 1 0 0 0 1 0 0 0
#> Alice 0 0 0 0 1 0 0 0
#> Jane 0 0 0 0 1 0 0 0
#> Dale 0 1 1 1 0 0 0 0
#> Pam 0 0 0 0 0 0 1 0
#> Carol 0 0 0 0 0 1 0 1
#> Tina 0 0 0 0 0 0 1 0
na_to_mean(missTest)
#> Betty Sue Alice Jane Dale Pam Carol Tina
#> Betty 0 1 0 0 0 0 0 0
#> Sue 1 0 0 0 1 0 0 0
#> Alice 0 0 0 1 1 1 0 0
#> Jane 0 0 1 0 1 0 0 0
#> Dale 0 1 1 1 0 0 0 0
#> Pam 0 0 0 0 0 0 1 0
#> Carol 0 0 0 0 0 1 0 1
#> Tina 0 0 0 0 0 0 1 0