[statnet_help] ego.ergm popsize

Carine Pachoud carine.pachoud at hotmail.fr
Thu Nov 23 07:57:52 PST 2023


ok thank you. Sorry this tool is new for me.

I have 4 waves. I have two tables of nodes, one with all the nodes (egos and alters) and one with the egos only (the 55 that I have interviewed). My question is how can I use ego.ergm if I do not have information on the alters (their attributes) ?

regards,
Carine
________________________________
De : Michał Bojanowski <michal2992 at gmail.com>
Envoyé : jeudi 23 novembre 2023 12:49
À : Carine Pachoud <carine.pachoud at hotmail.fr>
Cc : statnet_help at u.washington.edu <statnet_help at u.washington.edu>
Objet : Re: [statnet_help] ego.ergm popsize

Nope, `%v%` will not work that way. Technically it might be easiest to construct the 'egor' object directly from the edge list and attribute CSV like in the example at https://egor.tillt.net/articles/using_egor.html

Still, a more serious issue is that effectively every person in your data becomes an ego, while in your snowball sample, I presume, this was not the case. This leads me even more in the direction that the egocentric ERGM does not seem appropriate for your data. How many "waves" did the snowball have?

On Thu, Nov 23, 2023 at 4:36 PM Carine Pachoud <carine.pachoud at hotmail.fr<mailto:carine.pachoud at hotmail.fr>> wrote:
Ok. The nodes and the attributes are in a csv file and the edge list in another csv file. As I'm more familiar with complete networks and the ERGM package, I created the object in the same way and tried to integrate the attributes on the ERGM package model


# Load links
lien<-read.table("C:/Users/admin/Dropbox/Transformont/network/interne-discussion.csv", sep=";", header=TRUE)
lien[,1]<-as.character(lien[,1])
lien[,2]<-as.character(lien[,2])

# Load nodes (actors) attributes
noeud<-read.table("C:/Users/admin/Dropbox/Transformont/network/node-interviewed.csv", sep=";", header=TRUE, stringsAsFactors=FALSE)
row.names(noeud)<-as.character(noeud$node)
nrow(noeud)

# create the network object
f <- as.network(as.matrix(lien[,c(1:2)]), directed=F, loops = F, matrix.type="edgelist")
f
plot(f)

f.ego<-as.egor(f)
f.ego
f.ego$ego
f.ego$alter

# Attach nodes attributes
f.ego %v% "Nom" <- as.character(noeud[,"nom"])
...
________________________________
De : Michał Bojanowski <michal2992 at gmail.com<mailto:michal2992 at gmail.com>>
Envoyé : jeudi 23 novembre 2023 12:27
À : Carine Pachoud <carine.pachoud at hotmail.fr<mailto:carine.pachoud at hotmail.fr>>
Cc : statnet_help at u.washington.edu<mailto:statnet_help at u.washington.edu> <statnet_help at u.washington.edu<mailto:statnet_help at u.washington.edu>>
Objet : Re: [statnet_help] ego.ergm popsize

Yeah, the attribute variables are not in there. How did you create that object? Is your data originally as a `network` object? It will be easier to recreate it properly from the source rather than re-add what's missing.

On Thu, Nov 23, 2023 at 4:22 PM Carine Pachoud <carine.pachoud at hotmail.fr<mailto:carine.pachoud at hotmail.fr>> wrote:
here str(f.ego):

List of 3 $ ego : tibble [55 × 2] (S3: tbl_df/tbl/data.frame) ..$ .egoID : int [1:55] 1 2 3 4 5 6 7 8 9 10 ... ..$ vertex.names: chr [1:55] "1" "10" "11" "12" ... $ alter: tibble [430 × 3] (S3: tbl_df/tbl/data.frame) ..$ .altID : int [1:430] 30 25 18 10 36 17 16 3 51 32 ... ..$ .egoID : int [1:430] 1 1 1 1 1 1 1 1 2 2 ... ..$ vertex.names: chr [1:430] "36" "31" "25" "18" ... $ aatie: tibble [1,140 × 3] (S3: tbl_df/tbl/data.frame) ..$ .egoID: int [1:1140] 1 1 1 1 1 1 1 1 1 1 ... ..$ .srcID: int [1:1140] 30 25 25 25 25 18 18 18 10 10 ... ..$ .tgtID: int [1:1140] 25 18 10 16 30 17 10 25 3 25 ... - attr(*, "class")= chr [1:2] "egor" "list" - attr(*, "alter_design")=List of 1 ..$ max: num Inf - attr(*, "active")= chr "ego"

Ok it is surely different from ERGM. Do you know the commands to add node attributes with ego.ergm (numeric and character) ?

thanks!
Carine

________________________________
De : Michał Bojanowski <michal2992 at gmail.com<mailto:michal2992 at gmail.com>>
Envoyé : jeudi 23 novembre 2023 12:12
À : Carine Pachoud <carine.pachoud at hotmail.fr<mailto:carine.pachoud at hotmail.fr>>
Cc : statnet_help at u.washington.edu<mailto:statnet_help at u.washington.edu> <statnet_help at u.washington.edu<mailto:statnet_help at u.washington.edu>>
Objet : Re: [statnet_help] ego.ergm popsize

Thanks. The output of summary() suggests that you don't have any nodal attribute variables in the `f.ego` object. No `Type` variable in particular, so ergm.ego is not finding them when fitting the model. Can you send the output of `str(f.ego)`? Are you sure you've produced that object correctly?

On Thu, Nov 23, 2023 at 4:06 PM Carine Pachoud <carine.pachoud at hotmail.fr<mailto:carine.pachoud at hotmail.fr>> wrote:
Dear Michał,

here the summary for f.ego:


> summary(f.ego)

55 Egos/ Ego Networks
430 Alters
Min. Netsize 1
Average Netsize 7.81818181818182
Max. Netsize 31
Average Density 0.674972800136199
Alter survey design:
Maximum nominations: Inf

I tried on undirected network :
m17 <- ergm.ego(f.ego ~ edges+ nodefactor ("Type")+ nodematch("Type")+ nodefactor ("Date")+ nodematch ("Date")+ nodefactor("Commune")+ nodematch("Commune")+ nodefactor ("Mairie")+ nodematch("Mairie")+ nodecov ("LienE")+ nodefactor ("View")+ nodematch("View") + gwesp(0.1,fixed=T)+gwdsp (0.1,fixed=T),control = control.ergm.ego(ppopsize=990))

and now I get the following message:


Constructing pseudopopulation network.
Error in `ergm_Init_abort()`:! In unknown function: ‘Type’ is/are not valid nodal attribute(s).
Run `rlang::last_trace()` to see where the error occurred.> rlang::last_trace()
<error/rlang_error>Error in `ergm_Init_abort()`:! In unknown function: ‘Type’ is/are not valid nodal attribute(s).

I do not understand why the attribute is invalid (I tried with the package ERGM and it worked).

thank you for the reference, I will read it!

best regards,
Carine


________________________________
De : Michał Bojanowski <michal2992 at gmail.com<mailto:michal2992 at gmail.com>>
Envoyé : jeudi 23 novembre 2023 11:54
À : Carine Pachoud <carine.pachoud at hotmail.fr<mailto:carine.pachoud at hotmail.fr>>
Objet : Re: [statnet_help] ego.ergm popsize

... and:

4. The fact that you used snowball sampling to collect data makes inference with ergm.ego questionable because it assumes that the data is a probabilistic sample of egos. You may need a different model such as https://doi.org/10.1016/j.socnet.2015.11.003.

On Thu, Nov 23, 2023 at 3:47 PM Michał Bojanowski <michal2992 at gmail.com<mailto:michal2992 at gmail.com>> wrote:
Thanks Carine. Couple of issues/questions based on what you sent:

1. Can you please send the output of summary(f.ego) rather than m17? You use f.ego when fitting the model.
2. The egocentric ERGM implemented in ergm.ego assumes the network is undirected. Thus, you'd need to use the undirected variants of the terms such as nodefactor only (not nodeifactor and nodeofactor separately).
3. Based on what you send for (1) I should be able to tell what's the problem with ppopsize and popsize.

Michal

On Thu, Nov 23, 2023 at 3:43 PM Carine Pachoud <carine.pachoud at hotmail.fr<mailto:carine.pachoud at hotmail.fr>> wrote:
Hello Michal,

thank you for your quick answer !

Here the call :
m17 <- ergm.ego(f.ego ~ edges+ nodeifactor ("Type")+ nodeofactor ("Type")+nodematch("Type")+ nodeifactor ("Date")+ nodeofactor ("Date")+ nodematch ("Date")+ nodeifactor("Commune")+nodeofactor("Commune")+ nodematch("Commune")+ nodeifactor ("Mairie")+ nodeofactor("Mairie")+ nodematch("Mairie")+ nodeicov ("LienE")+ nodeocov ("LienE")+nodeifactor ("View")+ nodeofactor ("View")+nodematch("View") + gwesp(0.1,fixed=T)+gwdsp (0.1,fixed=T),control = control.ergm.ego(ppopsize=990))
summary(m17)

I tried again adding the actual ppopsize : 990 and I get a new message error :

Constructing pseudopopulation network.
Error: Egocentric statistic ‘nodeifactor’ function ‘EgoStat.nodeifactor’ not found.


> summary(m17)

Error: object 'm17' not found


This message appears for each of the terms.

The study focuses on a territorial agrifood system, including a diversity of actors (farmers, elected officials, civil society, advisors...) who have different visions of agriculture. In order to understand sustainable agrifood transformations, I try to see if the different groups holding different visions interact and how is structured the network (ERGM). I used a snowball sampling starting from 15 actors, central and in each typology.

best regards,
Carine Pachoud


________________________________
De : Michał Bojanowski <michal2992 at gmail.com<mailto:michal2992 at gmail.com>>
Envoyé : jeudi 23 novembre 2023 11:13
À : Carine Pachoud <carine.pachoud at hotmail.fr<mailto:carine.pachoud at hotmail.fr>>
Cc : statnet_help at u.washington.edu<mailto:statnet_help at u.washington.edu> <statnet_help at u.washington.edu<mailto:statnet_help at u.washington.edu>>
Objet : Re: [statnet_help] ego.ergm popsize

Hello Carine,

Can you please send the exact offending call that is triggering the error together with the output of calling summary() on your data object?

In general, population size (as opposed to the pseudo-population size) should correspond to the size of the population network (which is not observed in its entirety) you want to make inferences about and from which you sampled the egos. This inference is the main goal of the model implemented in ergm.ego. If such a population network does not exist or is hard to conceive as a theoretical device it might be difficult to interpret (some of) the results. What's the purpose of your analysis?

Best,
Michał


On Thu, Nov 23, 2023 at 2:51 PM Carine Pachoud <carine.pachoud at hotmail.fr<mailto:carine.pachoud at hotmail.fr>> wrote:
Dear ERGM users,

I previously worked with ERGM on complete networks. Today I am dealing with an egocentric network and the package ego.ergm. I have 55 nodes et 274 edges. I do not know the size of the population.

It's certainly a very simple adjustment to make but I'm stuck on the population size. When I want to run my model, I get the following error message:


Error in if (ppopsize < sampsize && !is.data.frame(control$ppopsize)) warning("Using a smaller pseudopopulation size than sample size usually does not make sense.") else if (ppopsize == :
missing value where TRUE/FALSE needed

I tried to fix the ppopsize with control = control.ergm.ego(ppopsize=1000) and also to fix the popsize (popsize=N, control=snctrl(ppopsize=N)), based on your tutorials, but I still have this error message.

Could you help me ?

thanks a lot!

best regards,
Carine Pachoud


[https://s-install.avcdn.net/ipm/preview/icons/icon-envelope-tick-round-orange-animated-no-repeat-v1.gif]<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
Sans virus.www.avast.com<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
_______________________________________________
statnet_help mailing list
statnet_help at u.washington.edu<mailto:statnet_help at u.washington.edu>
http://mailman13.u.washington.edu/mailman/listinfo/statnet_help
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman13.u.washington.edu/pipermail/statnet_help/attachments/20231123/3338bcc4/attachment.html>


More information about the statnet_help mailing list