I have a problem with generating network object for further ergm estimation in R. Namely, when I feed the network function with an adjacency matrix, it generates an error that my network contains loops and multiple edges, which is simply not true. I ran the same code with the same matrix about two years ago and everything was alright. Now I tried to use different versions of R, but all of them lead to the same problem. As an example, I also used the following simple matrix:
1 2 3 4 5 6 7 8 9 10
1 0 1 0 0 0 0 0 0 0 0
2 1 0 0 0 0 0 0 0 0 0
3 0 0 0 1 1 0 0 0 0 0
4 0 0 1 0 1 1 0 0 0 0
5 0 0 1 1 0 0 1 0 1 1
6 0 0 0 1 0 0 1 1 1 0
7 0 0 0 0 1 1 0 0 1 1
8 0 0 0 0 0 1 0 0 0 0
9 0 0 0 0 1 1 1 0 0 1
10 0 0 0 0 1 0 1 0 1 0
and the following code:
net <- network(data, directed=F, matrix.type='adjacency')
with data being the matrix above. The obtained error is:
Error: `loops` is `FALSE`, but `x` contains loops.
The following values are affected:
- `x[3, 1:2]`
- `x[4, 1:2]`
- `x[5, 1:2]`
- `x[6, 1:2]`
- `x[7, 1:2]`
- `x[8, 1:2]`
I would be very pleased if you could help me to find out what is the problem and what could be a possible remedy. Or recommend me some another ergm package to use, probably a python one
I am not sure what could be the problem in your case; maybe another function from a loaded package that interferes, but it seems to work for me (see reproducible example below):
Created on 2022-11-23 with reprex v2.0.2