gertvv / gemtc

GeMTC R package: model generation for network meta-analysis
GNU General Public License v3.0
44 stars 27 forks source link

Node-split model splitting wrong nodes #10

Closed gertvv closed 10 years ago

gertvv commented 10 years ago

Sofia Dias reports that the node-splitting code is splitting nodes that can't be split. She is using numerical treatment ID's, I'm guessing that might be the problem.

gertvv commented 10 years ago

Unable to reproduce, asked for clarification.

gertvv commented 10 years ago

Things go wrong when the treatments table is specified, for some reason. I suspect an automatic conversion to numerical is happening somewhere.

gertvv commented 10 years ago

It seems the root cause has been identified. Now to construct a failing test for the old behaviour and find all the places where vertices are addressed by index instead of name.

gertvv commented 10 years ago

This is what was happening:

  1. The treatment order specified was different from lexicographical order.
  2. mtc.model.nodesplit was using filter.network to create the network of indirect evidence.
  3. filter.network did not assign the treatments. This reset the treatments to lexicographical order
  4. mtc.init used the network graph to determine which comparisons to generate initial values for. The graph was generated from the filtered network, and had a treatment numbering derived from the factor numbering that was based on lexicographical rather than user-specified order.
  5. the vertices retrieved from the graph were coerced to numerical by R, and then coerced to the original treatments factor, where the order was user-specified, not lexicographical.

This can be fixed by either referring to vertices by name, or fixing the treatment order returned by filter.network. I'm opting for both.