-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Change appears to malfunction with isolates #59
Comments
I'll look into it. |
Looks like an issue in the handling of empty network statistics. |
require(tergm)
set.seed(0)
nw0 <- network.initialize(100, dir = FALSE)
# Correct values: 100, 100, -100, 100
summary(nw0 ~ Form(~isolates) + Persist(~isolates) + Diss(~isolates) + Change(~isolates), dynamic=TRUE)
#> Form~isolates Persist~isolates Diss~isolates Change~isolates
#> 200 100 100 200 Created on 2021-06-21 by the reprex package (v2.0.0) |
krivit
added a commit
that referenced
this issue
Jun 21, 2021
…hange() are now handled entirely in C; *_negate_on_intersect_lt_net_Network() functions have been simplified by calling *_on_intersect_lt_net_Network() and negating the result; and Change()'s C implementation for empty network statistics has been fixed. references #59
library(tergm)
nw <- network.initialize(100, dir = FALSE)
# y0, y1 empty.
# Correct values: 0, 100, 0, 100, 0, -100, 0, 100
summary(nw ~ Form(~edges+isolates) + Persist(~edges+isolates) + Diss(~edges+isolates) + Change(~edges+isolates), dynamic=TRUE)
#> Form~edges Form~isolates Persist~edges Persist~isolates
#> 0 100 0 100
#> Diss~edges Diss~isolates Change~edges Change~isolates
#> 0 -100 0 100
# y0, y1 both have (1,2)
nw[1,2] <- TRUE
# Correct values: 1, 98, 1, 98, -1, -98, 0, 100
summary(nw ~ Form(~edges+isolates) + Persist(~edges+isolates) + Diss(~edges+isolates) + Change(~edges+isolates), dynamic=TRUE)
#> Form~edges Form~isolates Persist~edges Persist~isolates
#> 1 98 1 98
#> Diss~edges Diss~isolates Change~edges Change~isolates
#> -1 -98 0 100
# y1 has (1,2), y0 has (1,2) and (3,4)
nw %n% "time" <- 1
nw %n% "lasttoggle" <- cbind(3,4,1)
# Correct values: 2, 96, 1, 98, -1, -98, 1, 98
summary(nw ~ Form(~edges+isolates) + Persist(~edges+isolates) + Diss(~edges+isolates) + Change(~edges+isolates), dynamic=TRUE)
#> Form~edges Form~isolates Persist~edges Persist~isolates
#> 2 96 1 98
#> Diss~edges Diss~isolates Change~edges Change~isolates
#> -1 -98 1 98
# y1 has (1,2), y0 has (1,2), (2,3), and (3,4)
nw %n% "lasttoggle" <- rbind(nw %n% "lasttoggle", cbind(2,3,1))
# Correct values: 3, 96, 1, 98, -1, -98, 2, 97
summary(nw ~ Form(~edges+isolates) + Persist(~edges+isolates) + Diss(~edges+isolates) + Change(~edges+isolates), dynamic=TRUE)
#> Form~edges Form~isolates Persist~edges Persist~isolates
#> 3 96 1 98
#> Diss~edges Diss~isolates Change~edges Change~isolates
#> -1 -98 2 97 Created on 2021-06-21 by the reprex package (v2.0.0) |
@chad-klumb, seems to be better now. Can you please turn these into unit tests? |
chad-klumb
added a commit
that referenced
this issue
Jun 21, 2021
This issue was closed.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
e.g.
produces
The text was updated successfully, but these errors were encountered: