Running ‘valued_fit.R’ [3s/5s]
  Running ‘valued_sim.R’ [5s/8s]
Running the tests in ‘tests/valued_fit.R’ failed.
Complete output:
  > #  File tests/valued_fit.R in package ergm.count, part of the Statnet suite
  > #  of packages for network analysis, https://statnet.org .
  > #
  > #  This software is distributed under the GPL-3 license.  It is free,
  > #  open source, and has the attribution requirements (GPL Section 7) at
  > #  https://statnet.org/attribution
  > #
  > #  Copyright 2008-2019 Statnet Commons
  > #######################################################################
  > library(ergm.count)
  Loading required package: ergm
  Loading required package: network
  
  'network' 1.17.1 (2021-06-12), part of the Statnet Project
  * 'news(package="network")' for changes since last version
  * 'citation("network")' for citation information
  * 'https://statnet.org' for help, support, and other information
  
  
  'ergm' 4.0.0 (2021-06-14), part of the Statnet Project
  * 'news(package="ergm")' for changes since last version
  * 'citation("ergm")' for citation information
  * 'https://statnet.org' for help, support, and other information
  
  'ergm' 4 is a major release that introduces a fair number of
  backwards-incompatible changes. Please type 'news(package="ergm")' for
  a list of major changes.
  
  
  'ergm.count' 3.4.0 (2019-05-15), part of the Statnet Project
  * 'news(package="ergm.count")' for changes since last version
  * 'citation("ergm.count")' for citation information
  * 'https://statnet.org' for help, support, and other information
  
  NOTE: The form of the term 'CMP' has been changed in version 3.2 of
  'ergm.count'. See the news or help('CMP') for more information.
  
  > set.seed(0)
  > 
  > ## Poisson-reference ERGM
  > 
  > n <- 5
  > 
  > m <- matrix(rpois(n^2,2),n,n)
  > diag(m) <- 0
  > y <- as.network(m, matrix.type="a", directed=TRUE, ignore.eval=FALSE, names.eval="w")
  > 
  > truth <- log(sum(m)/n/(n-1))
  > diag(m) <- NA
  > 
  > efit <- ergm(y ~ sum, response="w", reference=~Poisson, verbose=TRUE, control=control.ergm(MCMLE.effectiveSize=128))
  Evaluating network in model.
  Initializing unconstrained Metropolis-Hastings proposal: Best valid proposal 'PoissonTNT' cannot take into account hint(s) 'sparse'.
  'ergm.count:MH_PoissonTNT'.
  Initializing model...
  Model initialized.
  Using initial method 'CD'.
  Fitting initial model.
  Starting contrastive divergence estimation via CD-MCMLE:
  Iteration 1 of at most 60:
  Convergence test P-value:1.3e-26
  The log-likelihood improved by 0.8861.
  Iteration 2 of at most 60:
  Convergence test P-value:9.3e-07
  The log-likelihood improved by 0.1079.
  Iteration 3 of at most 60:
  Convergence test P-value:1.3e-02
  The log-likelihood improved by 0.02483.
  Iteration 4 of at most 60:
  Convergence test P-value:3.2e-01
  The log-likelihood improved by 0.003836.
  Iteration 5 of at most 60:
  Convergence test P-value:2.9e-02
  The log-likelihood improved by 0.01908.
  Iteration 6 of at most 60:
  Convergence test P-value:1e-01
  The log-likelihood improved by 0.01085.
  Iteration 7 of at most 60:
  Convergence test P-value:2e-01
  The log-likelihood improved by 0.006431.
  Iteration 8 of at most 60:
  Convergence test P-value:7.8e-01
  Convergence detected. Stopping.
  The log-likelihood improved by 0.0003124.
  Finished CD.
  Starting Monte Carlo maximum likelihood estimation (MCMLE):
  Density guard set to 10000 from an initial count of 19 edges.
  
  Iteration 1 of at most 60 with parameter:
        sum 
  0.7957236 
  Starting unconstrained MCMC...
  Back from unconstrained MCMC.
  New interval = 512.
  Average estimating function values:
       sum 
  4.208531 
  Starting MCMLE Optimization...
  Optimizing with step length 1.0000.
  Using lognormal metric (see control.ergm function).
  Using log-normal approx (no optim)
  The log-likelihood improved by 0.1707.
  Estimating equations are not within tolerance region.
  
  Iteration 2 of at most 60 with parameter:
       sum 
  0.714619 
  Starting unconstrained MCMC...
  Back from unconstrained MCMC.
  New interval = 256.
  Average estimating function values:
         sum 
  -0.9481481 
  Starting MCMLE Optimization...
  Optimizing with step length 1.0000.
  Using lognormal metric (see control.ergm function).
  Using log-normal approx (no optim)
  Starting MCMC s.e. computation.
  The log-likelihood improved by 0.0126.
  Distance from origin on tolerance region scale: 0.249685058435208 (previously 4.919275809692).
  Test statistic: T^2 = 13.1377961711536, with 1 free parameters and 134 degrees of freedom.
  Convergence test p-value: 0.0004. Converged with 99% confidence.
  Finished MCMLE.
  Evaluating log-likelihood at the estimate. Setting up bridge sampling...
  Initializing model and proposals...
  Best valid proposal 'PoissonTNT' cannot take into account hint(s) 'sparse'.
  Model and proposals initialized.
  Using 16 bridges: Running theta=[0.02316092].
  Running theta=[0.06948276].
  Running theta=[0.1158046].
  Running theta=[0.1621264].
  Running theta=[0.2084483].
  Running theta=[0.2547701].
  Running theta=[0.301092].
  Running theta=[0.3474138].
  Running theta=[0.3937357].
  Running theta=[0.4400575].
  Running theta=[0.4863793].
  Running theta=[0.5327012].
  Running theta=[0.579023].
  Running theta=[0.6253449].
  Running theta=[0.6716667].
  Running theta=[0.7179886].
  .
  Bridge sampling finished. Collating...
  Note: Null model likelihood calculation is not implemented for valued
  ERGMs at this time.  This means that all likelihood-based inference
  (LRT, Analysis of Deviance, AIC, BIC, etc.) is only valid between
  models with the same reference distribution and constraints.
  This model was fit using MCMC.  To examine model diagnostics and check
  for degeneracy, use the mcmc.diagnostics() function.
  > 
  > summary(efit)
  Call:
  ergm(formula = y ~ sum, response = "w", reference = ~Poisson, 
      control = control.ergm(MCMLE.effectiveSize = 128), verbose = TRUE)
  
  Monte Carlo Maximum Likelihood Results:
  
      Estimate Std. Error MCMC % z value Pr(>|z|)    
  sum   0.7411     0.1679      0   4.414   <1e-04 ***
  ---
  Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
  
       Null Deviance:   0.00  on 20  degrees of freedom
   Residual Deviance: -17.07  on 19  degrees of freedom
   
  Note that the null model likelihood and deviance are defined to be 0.
  This means that all likelihood-based inference (LRT, Analysis of
  Deviance, AIC, BIC, etc.) is only valid between models with the same
  reference distribution and constraints.
  
  AIC: -15.07  BIC: -14.07  (Smaller is better. MC Std. Err. = 0.3462)
  > true.llk <- sum(dpois(na.omit(c(m)), exp(coef(efit)), log=TRUE)) - sum(dpois(na.omit(c(m)), 1, log=TRUE))
  > 
  > stopifnot(abs(coef(efit)-truth)<0.02)
  Error: abs(coef(efit) - truth) < 0.02 is not TRUE
  Execution halted