The hardware and bandwidth for this mirror is donated by dogado GmbH, the Webhosting and Full Service-Cloud Provider. Check out our Wordpress Tutorial.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]dogado.de.

BSPBSS-vignette

library(BSPBSS)

A toy example

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:

library(BSPBSS)
set.seed(612)
sim = sim_2Dimage(length = 30, sigma = 5e-4, n = 30, smooth = 6)

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,

ini = init_bspbss(sim$X, sim$coords, q = 3, ker_par = c(0.1,50), num_eigen = 50)

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 Thu Oct 16 17:04:03 2025
#> 
#> zeta0.154297 stepsize_zeta 0.00712258 accp_rate_zeta 0.45
#> iter 200 Thu Oct 16 17:04:03 2025
#> 
#> zeta0.182201 stepsize_zeta 0.00783484 accp_rate_zeta 0.35
#> iter 300 Thu Oct 16 17:04:04 2025
#> 
#> zeta0.205042 stepsize_zeta 0.00861832 accp_rate_zeta 0.45
#> iter 400 Thu Oct 16 17:04:04 2025
#> 
#> zeta0.189928 stepsize_zeta 0.00948015 accp_rate_zeta 0.42
#> iter 500 Thu Oct 16 17:04:04 2025
#> 
#> zeta0.199043 stepsize_zeta 0.0104282 accp_rate_zeta 0.39
#> iter 600 Thu Oct 16 17:04:04 2025
#> 
#> zeta0.197815 stepsize_zeta 0.011471 accp_rate_zeta 0.39
#> iter 700 Thu Oct 16 17:04:05 2025
#> 
#> zeta0.22763 stepsize_zeta 0.0126181 accp_rate_zeta 0.34
#> iter 800 Thu Oct 16 17:04:05 2025
#> 
#> zeta0.166707 stepsize_zeta 0.0138799 accp_rate_zeta 0.31
#> iter 900 Thu Oct 16 17:04:05 2025
#> 
#> zeta0.188473 stepsize_zeta 0.0152679 accp_rate_zeta 0.22
#> iter 1000 Thu Oct 16 17:04:05 2025
#> 
#> zeta0.208003 stepsize_zeta 0.0152679 accp_rate_zeta 0.27
#> iter 1100 Thu Oct 16 17:04:06 2025
#> 
#> zeta0.176799 stepsize_zeta 0.0152679 accp_rate_zeta 0.24
#> iter 1200 Thu Oct 16 17:04:06 2025
#> 
#> zeta0.180526 stepsize_zeta 0.0152679 accp_rate_zeta 0.28
#> iter 1300 Thu Oct 16 17:04:06 2025
#> 
#> zeta0.158511 stepsize_zeta 0.0152679 accp_rate_zeta 0.31
#> iter 1400 Thu Oct 16 17:04:06 2025
#> 
#> zeta0.127507 stepsize_zeta 0.0152679 accp_rate_zeta 0.28
#> iter 1500 Thu Oct 16 17:04:07 2025
#> 
#> zeta0.18967 stepsize_zeta 0.0152679 accp_rate_zeta 0.23
#> iter 1600 Thu Oct 16 17:04:07 2025
#> 
#> zeta0.198324 stepsize_zeta 0.0152679 accp_rate_zeta 0.3
#> iter 1700 Thu Oct 16 17:04:07 2025
#> 
#> zeta0.183634 stepsize_zeta 0.0152679 accp_rate_zeta 0.3
#> iter 1800 Thu Oct 16 17:04:07 2025
#> 
#> zeta0.140081 stepsize_zeta 0.0152679 accp_rate_zeta 0.26
#> iter 1900 Thu Oct 16 17:04:08 2025
#> 
#> zeta0.244967 stepsize_zeta 0.0152679 accp_rate_zeta 0.29
#> iter 2000 Thu Oct 16 17:04:08 2025
#> 
#> zeta0.226313 stepsize_zeta 0.0152679 accp_rate_zeta 0.27

Then the results can be summarized by

res_sum = sum_mcmc_bspbss(res, ini$X, ini$kernel, start = 101, end = 200, select_p = 0.5)

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()`).

These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.
Health stats visible at Monitor.