fit_configuration: Fit configuration or configuration set to group networks

fit_configurationR Documentation

Fit configuration or configuration set to group networks

Description

fit_configuration fits a configuration to one or more group networks.

fit_configuration_set selects configurations from a set that best fit the given group networks.

Usage

fit_configuration(x, configuration, ...)

## Default S3 method:
fit_configuration(
  x,
  configuration,
  group_index,
  group_size,
  weights,
  parallel = FALSE,
  ...
)

## S3 method for class 'list'
fit_configuration(x, configuration, group_size, weights, parallel = FALSE, ...)

## S3 method for class 'igraph'
fit_configuration(x, configuration, attrname, ...)

## S3 method for class 'network'
fit_configuration(x, configuration, attrname, ...)

fit_configuration_set(x, configuration_set, ...)

## Default S3 method:
fit_configuration_set(
  x,
  configuration_set,
  ties.method = c("all", "first", "last", "random"),
  group_index,
  group_size,
  weights,
  parallel = FALSE,
  ...
)

## S3 method for class 'list'
fit_configuration_set(
  x,
  configuration_set,
  ties.method = c("all", "first", "last", "random"),
  group_size,
  weights,
  parallel = FALSE,
  ...
)

## S3 method for class 'igraph'
fit_configuration_set(
  x,
  configuration_set,
  ties.method = c("all", "first", "last", "random"),
  attrname,
  ...
)

## S3 method for class 'network'
fit_configuration_set(
  x,
  configuration_set,
  ties.method = c("all", "first", "last", "random"),
  attrname,
  ...
)

Arguments

x

A group network or list of group networks. A group network can be an adjacency matrix, edge list, igraph object, or network object. x may also be an edge list for multiple groups when group_index is provided.

configuration

A configuration object.

group_index

Vector of unique identifiers for each group network in x when x is an edge list. The length of group_index should match the number of rows in x. Providing a group index indicates to the function that x is an edge list. If x is a list, group_index should also be a list of the same length, with each element corresponding to the elements in x.

group_size

Numeric vector of group size(s) when x is an edge list. group_size must match the group size of configuration. Length of group_size should equal the number of rows in x. (Group size is repeated for all edge list rows in a group.) If x is a list of edge lists, group_size should also be a list of the same length.

weights

Numeric vector of edge weights when x is an edge list. Length should equal the number of rows in x. If x is a list, weights should also be a list of the same length, with each element corresponding to the elements in x.

parallel

Use parallel processing. Parallel processing can only be used when multiple group networks are being fit. To explicitly set the number of cores used, pass the number through ... using a "cores" parameter (e.g., cores = 4).

attrname

Attribute name that holds the edge weights (usually "weight").

configuration_set

A configuration_set object.

ties.method

When ties.method = "all", the function will return a configuration_fit_set object for a given group network. When ties.method is "first", "last", or "random", the function will return the first, last, or a random configuration_fit from a set.

Details

fit_configuration fits a single configuration to one or more group networks. All group networks must be the same size as the configuration.

For fit_configuration_set, group networks can be different sizes. The function will only fit configurations in the set that are the same size as a group network.

Fitting is done using a naive algorithm or using a linear program (LP) through the ROI package. The naive algorithm is written in C++ to improve performance and often is faster than LP solvers. To use an LP solver, pass the solver name and any solver parameters through ... to the ROI_solve function (e.g., solver = "glpk"). When parallel processing, also pass the solver package name and the associated ROI.plugin.* package name through ... using a "packages" parameter (e.g., packages = c("Rglpk","ROI.plugin.glpk")).

See SmallGroupNetwork for details of how configurations are fit to group networks.

Value

fit_configuration returns a configuration_fit object.

For a given group network, the fit_configuration_set returns a configuration_fit_set object with all configurations that best fit the group network when ties.method = "all". Otherwise it returns a configuration_fit object.

Methods (by class)

  • default: Fit configuration to group network(s) from adjacency matrix or edge list

  • list: Fit configuration to group networks from list of networks

  • igraph: Fit configuration to group network from network object

  • network: Fit configuration to group network from network object

  • default: Fit configuration set to group network(s) from adjacency matrix or edge list

  • list: Fit configuration set to group networks from list of networks

  • igraph: Fit configuration set to group network from igraph object

  • network: Fit configuration set to group network from network object

See Also

configuration, configuration_set

Examples


f <- star(4)[[1]]
set.seed(102)
x <- matrix(rnorm(16), 4)
fit_configuration(x, f)

f <- add_component(c(star(3, value = 2L),star(3))) 
el <- cbind(c(1,1,2,3), c(2,3,3,4))
w <- runif(4, 0, 3)
fit_configuration(el, f, group_size = 6, weights = w)

f_set <- c(
  star(4),
  subgroup_all(4, relation = "between"),
  subgroup(4),
  star(4:5),
  subgroup_all(4:5, relation = "between"),
  subgroup(4:5)
)
set.seed(102)
x <- list(
  matrix(rnorm(16), 4),
  matrix(rnorm(25), 5)
)
fit_group_network(x, f_sets)

stephen-l-jones/SmallGroupNetwork documentation built on April 25, 2022, 11:15 p.m.