statnet / ergm.ego

Fit, Simulate and Diagnose Exponential-Family Random Graph Models to Egocentrically Sampled Network Data https://statnet.org
Other
14 stars 4 forks source link

X axis values when plotting gof(GOF = 'esp') are incorrectly ordered #76

Closed francescavantaggiato closed 2 years ago

francescavantaggiato commented 2 years ago

Command
plot(gof(fitted_model, GOF="esp"))

returns an image where the esp are incorrectly ordered. In the plot, the order is esp0, esp1,esp10 …, esp2, esp20, esp21 etcetera. This suggests that R reads the esp values as character.

Example code below to reproduce error

library(ergm.ego)
toy_ego_nw <- make_egor(50, 32)
fit1 <- ergm.ego(toy_ego_nw ~ edges + absdiff('income') + nodefactor('sex'))
summary(fit1)
plot(gof(fit1, GOF='model'))
plot(gof(fit1, GOF='degree'))
plot(gof(fit1, GOF='esp'))

Additionally, in this specific toy example command

plot(gof(fitted_model, GOF='degree'))

in this specific example reports the following error:

Error: In term ‘degrange’ in package ‘ergm’: Term degrange must have from<to.

Why?

Thanks much,

F.

mbojan commented 2 years ago

Thanks for reporting. These are most likely byproducts of ergm going 4.0 recently.

With respect to ESP, as a temporary workaround you should be able to build the plot "by hand" using elements of the object returned by gof().

We need to take a more detailed look whats going on with the degree / degree-range case.