This is a basic example which shows you how to solve a common problem.
First we load the package and generate simulated images with a probabilistic ICA model:
The true source signals are three 2D geometric patterns (set
smooth=0 to generate patterns with sharp edges).
levelplot2D(sim$S,lim = c(-0.04,0.04), sim$coords)
#> Warning: Removed 177 rows containing missing values or values outside the scale range
#> (`geom_tile()`).which generate observed images such as
levelplot2D(sim$X[1:3,], lim = c(-0.12,0.12), sim$coords)
#> Warning: Removed 177 rows containing missing values or values outside the scale range
#> (`geom_tile()`).Then we generate initial values for mcmc,
and run!
res = mcmc_bspbss(ini$X,ini$init,ini$prior,ini$kernel,n.iter=2000,n.burn_in=1000,thin=10,show_step=100)
#> iter 100 Wed Jun 17 09:13:27 2026
#>
#> zeta0.122581 stepsize_zeta 0.00712258 accp_rate_zeta 0.37
#> iter 200 Wed Jun 17 09:13:27 2026
#>
#> zeta0.169392 stepsize_zeta 0.00783484 accp_rate_zeta 0.34
#> iter 300 Wed Jun 17 09:13:28 2026
#>
#> zeta0.183347 stepsize_zeta 0.00861832 accp_rate_zeta 0.35
#> iter 400 Wed Jun 17 09:13:28 2026
#>
#> zeta0.184539 stepsize_zeta 0.00948015 accp_rate_zeta 0.43
#> iter 500 Wed Jun 17 09:13:28 2026
#>
#> zeta0.244617 stepsize_zeta 0.0104282 accp_rate_zeta 0.34
#> iter 600 Wed Jun 17 09:13:28 2026
#>
#> zeta0.213486 stepsize_zeta 0.011471 accp_rate_zeta 0.33
#> iter 700 Wed Jun 17 09:13:29 2026
#>
#> zeta0.212432 stepsize_zeta 0.0126181 accp_rate_zeta 0.5
#> iter 800 Wed Jun 17 09:13:29 2026
#>
#> zeta0.196011 stepsize_zeta 0.0138799 accp_rate_zeta 0.36
#> iter 900 Wed Jun 17 09:13:29 2026
#>
#> zeta0.215478 stepsize_zeta 0.0152679 accp_rate_zeta 0.26
#> iter 1000 Wed Jun 17 09:13:29 2026
#>
#> zeta0.179026 stepsize_zeta 0.0152679 accp_rate_zeta 0.26
#> iter 1100 Wed Jun 17 09:13:30 2026
#>
#> zeta0.223209 stepsize_zeta 0.0152679 accp_rate_zeta 0.42
#> iter 1200 Wed Jun 17 09:13:30 2026
#>
#> zeta0.210055 stepsize_zeta 0.0152679 accp_rate_zeta 0.25
#> iter 1300 Wed Jun 17 09:13:30 2026
#>
#> zeta0.189362 stepsize_zeta 0.0152679 accp_rate_zeta 0.43
#> iter 1400 Wed Jun 17 09:13:30 2026
#>
#> zeta0.187921 stepsize_zeta 0.0152679 accp_rate_zeta 0.27
#> iter 1500 Wed Jun 17 09:13:31 2026
#>
#> zeta0.21858 stepsize_zeta 0.0152679 accp_rate_zeta 0.32
#> iter 1600 Wed Jun 17 09:13:31 2026
#>
#> zeta0.197298 stepsize_zeta 0.0152679 accp_rate_zeta 0.27
#> iter 1700 Wed Jun 17 09:13:31 2026
#>
#> zeta0.172833 stepsize_zeta 0.0152679 accp_rate_zeta 0.28
#> iter 1800 Wed Jun 17 09:13:31 2026
#>
#> zeta0.175111 stepsize_zeta 0.0152679 accp_rate_zeta 0.3
#> iter 1900 Wed Jun 17 09:13:32 2026
#>
#> zeta0.197636 stepsize_zeta 0.0152679 accp_rate_zeta 0.29
#> iter 2000 Wed Jun 17 09:13:32 2026
#>
#> zeta0.210071 stepsize_zeta 0.0152679 accp_rate_zeta 0.3Then the results can be summarized by
and shown by
levelplot2D(res_sum$S, lim = c(-1.3,1.3), sim$coords)
#> Warning: Removed 177 rows containing missing values or values outside the scale range
#> (`geom_tile()`).For comparison, we show the estimated sources provided by informax ICA here.
levelplot2D(ini$init$ICA_S, lim = c(-1.7,1.7), sim$coords)
#> Warning: Removed 177 rows containing missing values or values outside the scale range
#> (`geom_tile()`).