leifeld / btergm

Temporal Exponential Random Graph Models by Bootstrapped Pseudolikelihood
16 stars 10 forks source link

Reoccuring problem with gof-function #19

Open Laupheim opened 4 years ago

Laupheim commented 4 years ago

Hello,

unfortunately the gof-function is not working again. I used the updated version of btergm today. Here is what I got when I runned the script altogether with the data that I have send some days ago for error replication:

Starting GOF assessment on a single computing core....

No 'target' network(s) provided. Using networks on the left-hand side of the model formula as observed networks.

Simulating 50 networks from the following formula: networks[[1]] ~ edges + mutual + twopath + ctriple + nodeocov("Psychological Safety") + nodeicov("Psychological Safety") + nodeocov("Psychological Empowerment") + nodeicov("Psychological Empowerment") + offset(edgecov(offsmat[[1]]))

Simulating 50 networks from the following formula: networks[[2]] ~ edges + mutual + twopath + ctriple + nodeocov("Psychological Safety") + nodeicov("Psychological Safety") + nodeocov("Psychological Empowerment") + nodeicov("Psychological Empowerment") + offset(edgecov(offsmat[[2]]))

Simulating 50 networks from the following formula: networks[[3]] ~ edges + mutual + twopath + ctriple + nodeocov("Psychological Safety") + nodeicov("Psychological Safety") + nodeocov("Psychological Empowerment") + nodeicov("Psychological Empowerment") + offset(edgecov(offsmat[[3]]))

3 networks from which simulations are drawn were provided.

Processing statistic: Triad census Skipping statistic for the following reason: Error in 0:(nrow(mat) - 2): Argument der Länge 0 Processing statistic: Modularity (fast & greedy) Processing statistic: Tie prediction

summary(g0) Length Class Mode Triad census 4 boxplot list Modularity (fast & greedy) 4 univariate list Tie prediction 9 rocpr list

RplotGofError

Since I have got a proper output 3 days ago with the same data and code script, I do not think that the problem is caused by either of it.

RplotGoFPlot

Laupheim commented 4 years ago

Okay, so I have tried a few things now, and it seems that de-installing R and re-installing it, altogether with installing btergm from install_github("leifeld/btergm") does the trick. However, after I close and restart R, the error occurs again when I am running the code and loading btergm from the library.

So the problem might be caused by reloading the package with

library("btergm")

after I closed and restarted R. But I have no idea why this is.

Furthermore, the gof-function is also not working with nodefactor.

I hope this information is helpful.

leifeld commented 4 years ago

It sounds to me like you keep installing an old version of btergm for some reason. Perhaps you can diagnose the problem by printing the results of packageVersion("btergm") at the relevant stages when it does not work. It should show version 1.9.9.

Alternatively, if you keep running into problems with your local installation, you may want to use RStudio Cloud, where you can install the relevant packages in an online instance of RStudio. I sometimes recommend this to users whose local installation seems to cause problems.

leifeld commented 3 years ago

Closing because no further response. Please feel free to open a new issue if there are still any problems.

NGneery commented 9 months ago

Hello, I experienced a similar problem as Laupheim while using the gof function in btergm. Whatever gof statistics I requested, the gof() function only ever outputs geodesic distances, the FPR/TPR and Modularity (walktrap) statistics.

I already de- and reinstalled R (newest release 4.3.2) and reinstalled btergm (packageVersion("btergm") =‘1.10.11’) via install_github("leifeld/btergm"). I would be super grateful for any tips on how to solve this, thank you!

Here are 3 requests as examples:

  1. request: gof_m3 <- gof(m3)

    Starting GOF assessment on a single computing core....

Initial dimensions of the network and covariates: t=1 t=2 t=3 t=4 t=5 t=6 iat_snet (row) 185 185 185 185 185 185 iat_snet (col) 185 185 185 185 185 185 conflict_snet (row) 185 185 185 185 185 185 conflict_snet (col) 185 185 185 185 185 185 alliance_snet (row) 185 185 185 185 185 185 alliance_snet (col) 185 185 185 185 185 185

Same dimensions but different labels across networks within time steps. Trying to auto-adjust the dimensions of the networks. If this fails, provide conformable matrices or network objects.

All nodes are retained.

Number of nodes per time step after adjustment: t=1 t=2 t=3 t=4 t=5 t=6 maximum deleted nodes (row) 0 0 0 0 0 0 maximum deleted nodes (col) 0 0 0 0 0 0 remaining rows 185 185 185 185 185 185 remaining columns 185 185 185 185 185 185

Dimensions of the network and covariates after adjustment: t=1 t=2 t=3 t=4 t=5 t=6 iat_snet (row) 185 185 185 185 185 185 iat_snet (col) 185 185 185 185 185 185 conflict_snet (row) 185 185 185 185 185 185 conflict_snet (col) 185 185 185 185 185 185 alliance_snet (row) 185 185 185 185 185 185 alliance_snet (col) 185 185 185 185 185 185

No 'target' network(s) provided. Using networks on the left-hand side of the model formula as observed networks.

Simulating 100 networks from the following formula: iat_snet[[1]] ~ edges + gwesp(0.5, fixed = T) + gwodegree(0.5, fixed = T) + gwidegree(0.5, fixed = T) + edgecov(conflict_snet[[1]]) + edgecov(alliance_snet[[1]]) + nodematch("mil_burden_cat", diff = T) + nodematch("gdp_cat", diff = T) + absdiff("democracy") + nodeofactor("mil_burden_cat", levels = -1) + nodeifactor("mil_burden_cat", levels = -1) + nodeofactor("gdp_cat", levels = -1) + nodeifactor("gdp_cat", levels = -1) + nodeocov("ln_population") + nodeicov("ln_population") + nodeocov("democracy") + nodeicov("democracy") + nodeocov("sov_score") + nodeicov("sov_score") + nodeofactor("territory_95") + nodeifactor("territory_95") + nodeofactor("coup") + nodeifactor("coup") + nodeofactor("d_enemies") + nodeifactor("d_enemies")

...

6 networks from which simulations are drawn were provided.

Skipping statistic for the following reason: Error in 0:(nrow(mat) - 2): Argument der Länge 0 Skipping statistic for the following reason: Error in 0:(nrow(mat) - 2): Argument der Länge 0 Skipping statistic for the following reason: Error in as.edgelist.sna(dat): as.edgelist.sna input must be an adjacency matrix/array, edgelist matrix, network, or sparse matrix, or list thereof.

Skipping statistic for the following reason: Error in idegree(0:(nrow(mat) - 1)): konnte Funktion "idegree" nicht finden Processing statistic: Geodesic distances Processing statistic: Tie prediction Processing statistic: Modularity (walktrap)


I then tried a less computationally demanding one just to see how it'd turn out.

  1. request: gof_m1 <- gof(m1, nsim = 25, statistics = c(esp, geodesic, ideg, odeg), parallel = "snow", ncpus = 2)

Starting GOF assessment using parallel processing on 2 cores....

No covariates provided.

All networks are conformable.

No 'target' network(s) provided. Using networks on the left-hand side of the model formula as observed networks.

Simulating 10 networks from the following formula: iat_snet[[1]] ~ edges + gwesp(0.5, fixed = T) + gwodegree(0.5, fixed = T) + gwidegree(0.5, fixed = T)

Simulating 10 networks from the following formula: iat_snet[[2]] ~ edges + gwesp(0.5, fixed = T) + gwodegree(0.5, fixed = T) + gwidegree(0.5, fixed = T)

Simulating 10 networks from the following formula: iat_snet[[3]] ~ edges + gwesp(0.5, fixed = T) + gwodegree(0.5, fixed = T) + gwidegree(0.5, fixed = T)

Simulating 10 networks from the following formula: iat_snet[[4]] ~ edges + gwesp(0.5, fixed = T) + gwodegree(0.5, fixed = T) + gwidegree(0.5, fixed = T)

Simulating 10 networks from the following formula: iat_snet[[5]] ~ edges + gwesp(0.5, fixed = T) + gwodegree(0.5, fixed = T) + gwidegree(0.5, fixed = T)

Simulating 10 networks from the following formula: iat_snet[[6]] ~ edges + gwesp(0.5, fixed = T) + gwodegree(0.5, fixed = T) + gwidegree(0.5, fixed = T)

6 networks from which simulations are drawn were provided.

Skipping statistic for the following reason: Error in 0:(nrow(mat) - 2): Argument der Länge 0 Skipping statistic for the following reason: Error in 0:(nrow(mat) - 2): Argument der Länge 0 Skipping statistic for the following reason: Error in as.edgelist.sna(dat): as.edgelist.sna input must be an adjacency matrix/array, edgelist matrix, network, or sparse matrix, or list thereof.

Skipping statistic for the following reason: Error in idegree(0:(nrow(mat) - 1)): konnte Funktion "idegree" nicht finden Processing statistic: Geodesic distances Processing statistic: Tie prediction Processing statistic: Modularity (walktrap)


  1. request: gof_m2 <- gof(m2, nsim = 25, statistics = c(esp, geodesic, ideg, odeg), parallel = "snow", ncpus = 2)

Starting GOF assessment using parallel processing on 2 cores....

No covariates provided.

All networks are conformable.

No 'target' network(s) provided. Using networks on the left-hand side of the model formula as observed networks.

Simulating 25 networks from the following formula: iat_snet[[1]] ~ edges + gwesp(0.5, fixed = T) + gwodegree(0.5, fixed = T) + gwidegree(0.5, fixed = T)

Simulating 25 networks from the following formula: iat_snet[[2]] ~ edges + gwesp(0.5, fixed = T) + gwodegree(0.5, fixed = T) + gwidegree(0.5, fixed = T)

Simulating 25 networks from the following formula: iat_snet[[3]] ~ edges + gwesp(0.5, fixed = T) + gwodegree(0.5, fixed = T) + gwidegree(0.5, fixed = T)

Simulating 25 networks from the following formula: iat_snet[[4]] ~ edges + gwesp(0.5, fixed = T) + gwodegree(0.5, fixed = T) + gwidegree(0.5, fixed = T)

Simulating 25 networks from the following formula: iat_snet[[5]] ~ edges + gwesp(0.5, fixed = T) + gwodegree(0.5, fixed = T) + gwidegree(0.5, fixed = T)

Simulating 25 networks from the following formula: iat_snet[[6]] ~ edges + gwesp(0.5, fixed = T) + gwodegree(0.5, fixed = T) + gwidegree(0.5, fixed = T)

6 networks from which simulations are drawn were provided.

Skipping statistic for the following reason: Error in 0:(nrow(mat) - 2): Argument der Länge 0 Processing statistic: Geodesic distances Skipping statistic for the following reason: Error in idegree(0:(nrow(mat) - 1)): konnte Funktion "idegree" nicht finden Skipping statistic for the following reason: Error in odegree(0:(nrow(mat) - 1)): konnte Funktion "odegree" nicht finden

leifeld commented 9 months ago

Can you provide a minimal, self-contained, reproducible example? Then I can try to diagnose the problem. Thanks.