R Under development (unstable) (2025-11-25 r89063) -- "Unsuffered Consequences" Copyright (C) 2025 The R Foundation for Statistical Computing Platform: x86_64-pc-linux-gnu R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. Natural language support but running in an English locale R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > pkgname <- "iglm" > source(file.path(R.home("share"), "R", "examples-header.R")) > options(warn = 1) > library('iglm') Loading required package: RcppProgress > > base::assign(".oldSearch", base::search(), pos = 'CheckExEnv') > base::assign(".old_wd", base::getwd(), pos = 'CheckExEnv') > cleanEx() > nameEx("count_statistics") > ### * count_statistics > > flush(stderr()); flush(stdout()) > > ### Name: count_statistics > ### Title: Compute Statistics > ### Aliases: count_statistics > > ### ** Examples > > # Create a iglm.data object > n_actors = 10 > neighborhood = matrix(1, nrow = n_actors, ncol = n_actors) > type_x <- "binomial" > type_y <- "binomial" > x_attr_data <- rbinom(n_actors, 1, 0.5) > y_attr_data <- rbinom(n_actors, 1, 0.5) > z_net_data <- matrix(0, nrow = n_actors, ncol = n_actors) > object = iglm.data(z_network = z_net_data, x_attribute = x_attr_data, + y_attribute = y_attr_data, neighborhood = neighborhood, + directed = FALSE,type_x = type_x,type_y = type_y) > count_statistics(object ~ edges(mode = "local") + attribute_y + attribute_x) /data/gannet/ripley/R/test-dev/RcppArmadillo/include/current/armadillo_bits/subview_meat.hpp:1413:54: runtime error: reference binding to null pointer of type 'const double' #0 0x7bc05e849c49 in arma::subview::colptr(unsigned long long) /data/gannet/ripley/R/test-dev/RcppArmadillo/include/current/armadillo_bits/subview_meat.hpp:1413 #1 0x7bc05e849c49 in arma::subview_col::subview_col(arma::Mat const&, unsigned long long) /data/gannet/ripley/R/test-dev/RcppArmadillo/include/current/armadillo_bits/subview_meat.hpp:3267 #2 0x7bc05e6da747 in arma::Mat::col(unsigned long long) /data/gannet/ripley/R/test-dev/RcppArmadillo/include/current/armadillo_bits/Mat_meat.hpp:3450 #3 0x7bc05e6da747 in mat_to_map(arma::Mat, int, bool, std::unordered_map, std::equal_to, std::allocator >, std::hash, std::equal_to, std::allocator, std::equal_to, std::allocator > > > >&, std::unordered_map, std::equal_to, std::allocator >, std::hash, std::equal_to, std::allocator, std::equal_to, std::allocator > > > >&) ../inst/include/iglm/helper_functions.h:101 #4 0x7bc05e6f1acb in Network::Network(int, bool, arma::Mat) ../inst/include/iglm/network_class.h:35 #5 0x7bc05e6f1acb in XZ_class::XZ_class(int, bool, arma::Mat, arma::Col, arma::Mat, arma::Mat, std::__cxx11::basic_string, std::allocator >, double) ../inst/include/iglm/xz_class.h:97 #6 0x7bc05e6f1acb in XYZ_class::XYZ_class(int, bool, arma::Col, arma::Col, arma::Mat, arma::Mat, arma::Mat, std::__cxx11::basic_string, std::allocator >, std::__cxx11::basic_string, std::allocator >, double, double) ../inst/include/iglm/xyz_class.h:40 #7 0x7bc05e6fd7f3 in xyz_count_global(arma::Mat, arma::Col, arma::Col, arma::Mat, arma::Mat, bool, std::vector, std::allocator >, std::allocator, std::allocator > > >, int, std::vector, std::allocator > >&, std::vector >&, std::__cxx11::basic_string, std::allocator >, std::__cxx11::basic_string, std::allocator >, double, double) /data/gannet/ripley/R/packages/tests-gcc-SAN/iglm/src/xyz_sampling.cpp:224 #8 0x7bc05e5cbc91 in _iglm_xyz_count_global /data/gannet/ripley/R/packages/tests-gcc-SAN/iglm/src/RcppExports.cpp:43 #9 0x00000074b9f5 in R_doDotCall /data/gannet/ripley/R/svn/R-devel/src/main/dotcode.c:813 #10 0x0000008e26ca in bcEval_loop /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:8664 #11 0x0000008b8f0b in bcEval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:7497 #12 0x000000859282 in Rf_eval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:1167 #13 0x00000086efca in R_execClosure /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:2389 #14 0x00000087308a in applyClosure_core /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:2302 #15 0x000000859923 in Rf_applyClosure /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:2324 #16 0x000000859923 in Rf_eval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:1280 #17 0x0000009ff648 in Rf_ReplIteration /data/gannet/ripley/R/svn/R-devel/src/main/main.c:264 #18 0x0000009ff648 in R_ReplConsole /data/gannet/ripley/R/svn/R-devel/src/main/main.c:317 #19 0x000000a04a7a in run_Rmainloop /data/gannet/ripley/R/svn/R-devel/src/main/main.c:1235 #20 0x000000a0ec92 in Rf_mainloop /data/gannet/ripley/R/svn/R-devel/src/main/main.c:1242 #21 0x00000041318f in main /data/gannet/ripley/R/svn/R-devel/src/main/Rmain.c:29 #22 0x7fc07a8115f4 in __libc_start_call_main (/lib64/libc.so.6+0x35f4) (BuildId: a1dda014206b55b07f58fe8db80121b752dc3d03) #23 0x7fc07a8116a7 in __libc_start_main@@GLIBC_2.34 (/lib64/libc.so.6+0x36a7) (BuildId: a1dda014206b55b07f58fe8db80121b752dc3d03) #24 0x000000413b54 in _start (/data/gannet/ripley/R/gcc-SAN3/bin/exec/R+0x413b54) (BuildId: d72f18244a1aebdcb6b557766816e31e8f422f5c) /data/gannet/ripley/R/test-dev/RcppArmadillo/include/current/armadillo_bits/access.hpp:26:100: runtime error: reference binding to null pointer of type 'double' #0 0x7bc05e849af1 in double& arma::access::rw(double const&) /data/gannet/ripley/R/test-dev/RcppArmadillo/include/current/armadillo_bits/access.hpp:26 #1 0x7bc05e849af1 in arma::subview::colptr(unsigned long long) /data/gannet/ripley/R/test-dev/RcppArmadillo/include/current/armadillo_bits/subview_meat.hpp:1413 #2 0x7bc05e849af1 in arma::subview_col::subview_col(arma::Mat const&, unsigned long long) /data/gannet/ripley/R/test-dev/RcppArmadillo/include/current/armadillo_bits/subview_meat.hpp:3267 #3 0x7bc05e6da747 in arma::Mat::col(unsigned long long) /data/gannet/ripley/R/test-dev/RcppArmadillo/include/current/armadillo_bits/Mat_meat.hpp:3450 #4 0x7bc05e6da747 in mat_to_map(arma::Mat, int, bool, std::unordered_map, std::equal_to, std::allocator >, std::hash, std::equal_to, std::allocator, std::equal_to, std::allocator > > > >&, std::unordered_map, std::equal_to, std::allocator >, std::hash, std::equal_to, std::allocator, std::equal_to, std::allocator > > > >&) ../inst/include/iglm/helper_functions.h:101 #5 0x7bc05e6f1acb in Network::Network(int, bool, arma::Mat) ../inst/include/iglm/network_class.h:35 #6 0x7bc05e6f1acb in XZ_class::XZ_class(int, bool, arma::Mat, arma::Col, arma::Mat, arma::Mat, std::__cxx11::basic_string, std::allocator >, double) ../inst/include/iglm/xz_class.h:97 #7 0x7bc05e6f1acb in XYZ_class::XYZ_class(int, bool, arma::Col, arma::Col, arma::Mat, arma::Mat, arma::Mat, std::__cxx11::basic_string, std::allocator >, std::__cxx11::basic_string, std::allocator >, double, double) ../inst/include/iglm/xyz_class.h:40 #8 0x7bc05e6fd7f3 in xyz_count_global(arma::Mat, arma::Col, arma::Col, arma::Mat, arma::Mat, bool, std::vector, std::allocator >, std::allocator, std::allocator > > >, int, std::vector, std::allocator > >&, std::vector >&, std::__cxx11::basic_string, std::allocator >, std::__cxx11::basic_string, std::allocator >, double, double) /data/gannet/ripley/R/packages/tests-gcc-SAN/iglm/src/xyz_sampling.cpp:224 #9 0x7bc05e5cbc91 in _iglm_xyz_count_global /data/gannet/ripley/R/packages/tests-gcc-SAN/iglm/src/RcppExports.cpp:43 #10 0x00000074b9f5 in R_doDotCall /data/gannet/ripley/R/svn/R-devel/src/main/dotcode.c:813 #11 0x0000008e26ca in bcEval_loop /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:8664 #12 0x0000008b8f0b in bcEval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:7497 #13 0x000000859282 in Rf_eval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:1167 #14 0x00000086efca in R_execClosure /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:2389 #15 0x00000087308a in applyClosure_core /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:2302 #16 0x000000859923 in Rf_applyClosure /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:2324 #17 0x000000859923 in Rf_eval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:1280 #18 0x0000009ff648 in Rf_ReplIteration /data/gannet/ripley/R/svn/R-devel/src/main/main.c:264 #19 0x0000009ff648 in R_ReplConsole /data/gannet/ripley/R/svn/R-devel/src/main/main.c:317 #20 0x000000a04a7a in run_Rmainloop /data/gannet/ripley/R/svn/R-devel/src/main/main.c:1235 #21 0x000000a0ec92 in Rf_mainloop /data/gannet/ripley/R/svn/R-devel/src/main/main.c:1242 #22 0x00000041318f in main /data/gannet/ripley/R/svn/R-devel/src/main/Rmain.c:29 #23 0x7fc07a8115f4 in __libc_start_call_main (/lib64/libc.so.6+0x35f4) (BuildId: a1dda014206b55b07f58fe8db80121b752dc3d03) #24 0x7fc07a8116a7 in __libc_start_main@@GLIBC_2.34 (/lib64/libc.so.6+0x36a7) (BuildId: a1dda014206b55b07f58fe8db80121b752dc3d03) #25 0x000000413b54 in _start (/data/gannet/ripley/R/gcc-SAN3/bin/exec/R+0x413b54) (BuildId: d72f18244a1aebdcb6b557766816e31e8f422f5c) edges(mode = 'local') attribute_y attribute_x 0 5 6 > > > > cleanEx() > nameEx("iglm") > ### * iglm > > flush(stderr()); flush(stdout()) > > ### Name: iglm > ### Title: Construct a iglm Model Specification Object > ### Aliases: iglm iglm_object > > ### ** Examples > > # Example usage: > library(iglm) > # Create a iglm.data data object (example) > n_actors <- 50 > neighborhood <- matrix(1, nrow = n_actors, ncol = n_actors) > xyz_obj <- iglm.data(neighborhood = neighborhood, directed = FALSE, + type_x = "binomial", type_y = "binomial") > # Define ground truth coefficients > gt_coef <- c("edges_local" = 3, "attribute_y" = -1, "attribute_x" = -1) > gt_coef_pop <- rnorm(n = n_actors, -2, 1) > # Define MCMC sampler > sampler_new <- sampler.iglm(n_burn_in = 100, n_simulation = 10, + sampler.x = sampler.net_attr(n_proposals = n_actors * 10, seed = 13), + sampler.y = sampler.net_attr(n_proposals = n_actors * 10, seed = 32), + sampler.z = sampler.net_attr(n_proposals = sum(neighborhood > 0 + ) * 10, seed = 134), + init_empty = FALSE) > # Create iglm model specification > model_tmp_new <- iglm(formula = xyz_obj ~ edges(mode = "local") + + attribute_y + attribute_x + popularity, + coef = gt_coef, + coef_popularity = gt_coef_pop, + sampler = sampler_new, + control = control.iglm(accelerated = FALSE, + max_it = 200, display_progress = FALSE, var = TRUE)) > # Simulate from the model > model_tmp_new$simulate() 0% 10 20 30 40 50 60 70 80 90 100% [----|----|----|----|----|----|----|----|----|----| **************************************************| > model_tmp_new$set_target(model_tmp_new$get_samples()[[1]]) > > # Estimate model parameters > model_tmp_new$estimate() > > # Model Assessment > model_tmp_new$model_assessment(formula = ~ degree_distribution ) > # model_tmp_new$results$plot(model_assessment = TRUE) > > > > > cleanEx() > nameEx("iglm.data") > ### * iglm.data > > flush(stderr()); flush(stdout()) > > ### Name: iglm.data > ### Title: Constructor for the iglm.data R6 object > ### Aliases: iglm.data > > ### ** Examples > > data(state_twitter) > state_twitter$iglm.data$degree_distribution(prob = FALSE, plot = TRUE) > state_twitter$iglm.data$geodesic_distances_distribution(prob = FALSE, plot = TRUE) > state_twitter$iglm.data$density_x() > state_twitter$iglm.data$density_y() > > # Generate a small iglm data object either via adjacency matrix or edgelist > tmp_adjacency <- iglm.data(z_network = matrix(c(0,1,1,0, + 1,0,0,1, + 1,0,0,1, + 0,1,1,0), nrow=4, byrow=TRUE), + directed = FALSE, + n_actor = 4, + type_x = "binomial", + type_y = "binomial") > > > tmp_edgelist <- iglm.data(z_network = tmp_adjacency$z_network, + directed = FALSE, + n_actor = 4, + type_x = "binomial", + type_y = "binomial") > > tmp_edgelist$density_z() > tmp_adjacency$density_z() > > > > cleanEx() > nameEx("sampler.iglm") > ### * sampler.iglm > > flush(stderr()); flush(stdout()) > > ### Name: sampler.iglm > ### Title: Constructor for a iglm Sampler > ### Aliases: sampler.iglm > > ### ** Examples > > n_actors <- 50 > sampler_new <- sampler.iglm(n_burn_in = 100, n_simulation = 10, + sampler.x = sampler.net_attr(n_proposals = n_actors * 10, seed = 13), + sampler.y = sampler.net_attr(n_proposals = n_actors * 10, seed = 32), + sampler.z = sampler.net_attr(n_proposals = n_actors^2, seed = 134), + init_empty = FALSE) > sampler_new Sampler settings ------------------------------------------------------------ Core parameters n_simulation :10 n_burn_in :100 init_empty :FALSE gibbs :FALSE Sub-samplers sampler.x: Number of proposals : 500 Random seed : 13 sampler.y: Number of proposals : 500 Random seed : 32 sampler.z: Number of proposals : 2500 Random seed : 134 > # Change some values of the sampler > sampler_new$n_simulation [1] 10 > sampler_new$set_n_simulation(100) > sampler_new$n_simulation [1] 100 > > > > cleanEx() > nameEx("sampler.net_attr") > ### * sampler.net_attr > > flush(stderr()); flush(stdout()) > > ### Name: sampler.net_attr > ### Title: Constructor for Single Component Sampler Settings > ### Aliases: sampler.net_attr > > ### ** Examples > > # Default settings > sampler_comp_default <- sampler.net_attr() > sampler_comp_default Number of proposals : 10000 Random seed : 548676 > > # Custom settings > sampler_comp_custom <- sampler.net_attr(n_proposals = 50000, seed = 123) > sampler_comp_custom Number of proposals : 50000 Random seed : 123 > > > > ### *