Skip to content
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

b1degree and b2degree count the other partition nodes as isolates? #591

Open
mbojan opened this issue Dec 11, 2024 · 2 comments
Open

b1degree and b2degree count the other partition nodes as isolates? #591

mbojan opened this issue Dec 11, 2024 · 2 comments

Comments

@mbojan
Copy link
Member

mbojan commented Dec 11, 2024

Is this correct and intended? I'd expect b1degree(0) to be 1 and b2degree(0) to be 2...

suppressPackageStartupMessages({
  library(ergm)
})
network.initialize(5, directed=FALSE, bipartite=2) -> net
add.edge(net, 1, 3)
net
#>  Network attributes:
#>   vertices = 5 
#>   directed = FALSE 
#>   hyper = FALSE 
#>   loops = FALSE 
#>   multiple = FALSE 
#>   bipartite = 2 
#>   total edges= 1 
#>     missing edges= 0 
#>     non-missing edges= 1 
#> 
#>  Vertex attribute names: 
#>     vertex.names 
#> 
#> No edge attributes
as.matrix(net)
#>   3 4 5
#> 1 1 0 0
#> 2 0 0 0
summary(net ~ b1degree(0:1) + b2degree(0:1))
#> b1degree0 b1degree1 b2degree0 b2degree1 
#>         4         1         4         1

I spotted that because of the degree=0 counts in:

> degreedist(davis)
Bipartite mode 2 degree distribution:
 0  3  4  5  6  8 10 12 14 
18  4  2  1  2  2  1  1  1 
Bipartite mode 1 degree distribution:
 0  2  3  4  5  6  7  8 
14  3  1  6  1  1  3  3 
@krivit
Copy link
Member

krivit commented Dec 11, 2024

I think that's a bug. The good news is that the statistics are off by a constant, so model coefficients are unaffected.

@mbojan
Copy link
Member Author

mbojan commented Dec 11, 2024

oops

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants