statnet / ergm.ego

Fit, Simulate and Diagnose Exponential-Family Random Graph Models to Egocentrically Sampled Network Data https://statnet.org
Other
14 stars 4 forks source link

Name missmatch in "target.stats" #5

Closed mbojan closed 7 years ago

mbojan commented 7 years ago

I am getting

> mod1 <- ergm.ego( egodata ~ edges + 
+                   nodematch("sex") + nodefactor("sex") + 
+                     nodematch("edu") + nodefactor("edu") + 
+                     nodefactor("wiek") + nodematch("wiek") )
Constructing pseudopopulation network.
Error in vector.namesmatch(target.stats, names(nw.stats)) : 
  Name missmatch in "target.stats". Specify by position.

> traceback()
4: stop("Name missmatch in \"", errname, "\". Specify by position.")
3: vector.namesmatch(target.stats, names(nw.stats))
2: ergm(ergm.formula, target.stats = m, offset.coef = ergm.offset.coef, 
       ..., eval.loglik = FALSE, control = control$ergm.control)
1: ergm.ego(egodata ~ edges + nodematch("sex") + nodefactor("sex") + 
       nodematch("edu") + nodefactor("edu") + nodefactor("wiek") + 
    ...

with

> sessionInfo()
R version 3.3.3 (2017-03-06)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 16.04.2 LTS

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C               LC_TIME=pl_PL.UTF-8       
 [4] LC_COLLATE=en_US.UTF-8     LC_MONETARY=pl_PL.UTF-8    LC_MESSAGES=en_US.UTF-8   
 [7] LC_PAPER=pl_PL.UTF-8       LC_NAME=C                  LC_ADDRESS=C              
[10] LC_TELEPHONE=C             LC_MEASUREMENT=pl_PL.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] ergm.ego_0.4-617843.115-2017.03.03-21.49.38 ergm_4.0-14728-2017.03.29-22.20.00         
[3] network_1.13.0                              statnet.common_3.3.0                       

loaded via a namespace (and not attached):
 [1] lattice_0.20-35    digest_0.6.12      withr_1.0.2        MASS_7.3-45        grid_3.3.3        
 [6] coda_0.19-1        robustbase_0.92-7  Matrix_1.2-8       trust_0.1-7        devtools_1.12.0   
[11] RColorBrewer_1.1-2 tools_3.3.3        DEoptimR_1.0-8     parallel_3.3.3     memoise_1.0.0     
[16] lpSolve_5.6.13    
mbojan commented 7 years ago

I'm doing a little bit of debugging which led me into ergm code. I dont understand whats going on exactly yet, so my debugging may perhaps need debugging itself. Anyway:

Looks like in line 31 of ergm()

    nw.stats <- summary(remove.offset.formula(formula), 
      response = response)

The summary call above returns a vector of target statistics which is shorter than target.stats vector with which ergm() is called in the first place. Some of the nodefactor parameters are missing. Not sure why yet.

Names of both vectors are then compared with vector.namesmatch which throws an error.

mbojan commented 7 years ago

The error is on my end. All works. As I don't intend to embarrass myself, I will not go into details. Closing.