Skip to content

Decide what net_x_correlation() should do without a second network #27

Description

@jhollway

net_x_correlation() is the only one of the three motif_periods functions that
requires object2. Its two siblings branch when object2 is missing:

if(!missing(object2)){
  net <- list(net, object2)
} else if(manynet::is_longitudinal(net)){
  net <- manynet::to_waves(net)
}

net_x_correlation() does not, so net_x_correlation(ison_monks) fails with
"argument "object2" is missing, with no default", although the shared
@description says these net_*() functions "return a numeric vector the
length of the number of networks minus one. E.g., the periods between waves."

Documented behaviour and implemented behaviour must agree, so either the code
or the description has to move.

Decisions to make

  • Longitudinal. Follow the siblings and correlate each consecutive pair of
    waves, or correlate only the first and last wave? The siblings give
    consecutive pairs, which argues for consistency, but a start/end comparison
    is the more common question of a correlation specifically.
  • Multiplex. Should a multiplex network correlate its layers pairwise?
    Neither sibling does this today, so it would make net_x_correlation()
    behave unlike the other two on the same input.
  • Which cells. The current body sets the diagonal to NA for a simple
    network and the upper triangle to NA for an undirected one, then uses
    complete.obs. Whatever branch is added has to apply the same masking to
    each pair, and the two networks must be of the same dimensions.

Related

net_x_change(ison_classmates) and net_x_stability(ison_classmates) both
return all-NA, although both return real numbers on ison_monks. Worth
checking in the same pass, since it is the same longitudinal branch.

Found while auditing the package against CONTRIBUTING.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions