statnetWeb
statnetWeb copied to clipboard
Factor ordering for legends and summary model output
Current ordering is a bit odd. For example, look at faux.mesa. Here, alphabetic (with "other" at end) would be best, but may be difficult to achieve. Note that the same ordering would be useful for nodefactor and nodematch in the model output. If R is using the order encountered in the data, sorting might help, but: 1. i'm not sure how to sort a network object, and 2. achieving alphabetical order for multiple factors may not be possible; and 3. that wouldn't guarantee "other" at the end.
Worth looking at the "relevel" command -- maybe that will work here.
I have ordered the factors in the legend to be alphabetic with "other" at the end.
I'm not sure I understand which part of the app you are referring to as summary model output, but if it is the Summary tab at the bottom of the Fit Model page: It seems that factors are listed in the same order they are passed in the ergm formula. The order of the formula can be specified within the R code, currently it is the terms that don't require additional menu options, followed by those that do. Within those two categories the terms are somewhat in alphabetic order, the exception being that idegree and odegree are listed together in the same placement degree would be in.
On Mon, 28 Jul 2014, ebey wrote:
I have ordered the factors in the legend to be alphabetic with "other" at the end.
great.
I'm not sure I understand which part of the app you are referring to as summary model output, but if it is the Summary tab at the bottom of the Fit Model page:
yes.
It seems that factors are listed in the same order they are passed in the ergm formula. The order of the formula can be specified within the R code, currently it is the terms that don't require additional menu options, followed by those that do. Within those two categories the terms are somewhat in alphabetic order, the exception being that idegree and odegree are listed together in the same placement degree would be in.
i meant the ordering of factor levels, within term, and was referring to the same ordering i was requesting in the plot legend. (but thx, i didn't realize the ordering of terms was no-options + options).
I see. The attribute names within term are in alphabetical order (I have control over this, but we don't need to worry about 'Other's), as are the factor levels (I don't have control over this, so 'Other' comes before 'White')
Right, that's why I was suggesting you take a look at the "relevel" command in R.
But check out this page: http://www.cookbook-r.com/Manipulating_data/Changing_the_order_of_levels_of_a_factor/
I suspect we would want to recreate the dataset with an ordered factor for a future release of statnet.
This, like a few other things, make me realize that data manipulation will need to be addressed at some point.