R Under development (unstable) (2025-11-16 r89026 ucrt) -- "Unsuffered Consequences" Copyright (C) 2025 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 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. 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. > #### testing invisible functions #### > library(bkmrhat) Loading required package: coda Diagnostics and parallel chain functioning for Bayesian kernel machine regression > > set.seed(111) > dat <- bkmr::SimData(n = 50, M = 5, ind=1:3, Zgen="realistic") > y <- dat$y > Z <- dat$Z > X <- cbind(dat$X, rnorm(50)) > > # run 10 initial iterations for a model with only 2 exposures > Z2 = Z[,1:2] > kmfitbma.start <- suppressWarnings(bkmr::kmbayes(y = y, Z = Z2, X = X, iter = 10, verbose = FALSE, varsel = TRUE, est.h = TRUE)) Iteration: 2 (20% completed; 0.00958 secs elapsed) Iteration: 3 (30% completed; 0.01167 secs elapsed) Iteration: 4 (40% completed; 0.01476 secs elapsed) Iteration: 5 (50% completed; 0.01736 secs elapsed) Iteration: 6 (60% completed; 0.01994 secs elapsed) Iteration: 7 (70% completed; 0.02256 secs elapsed) Iteration: 8 (80% completed; 0.02523 secs elapsed) Iteration: 9 (90% completed; 0.02783 secs elapsed) Iteration: 10 (100% completed; 0.03074 secs elapsed) > > #.extractparms > suppressWarnings(bkmrhat:::.extractparms(kmfitbma.start)) h.hat1 h.hat2 h.hat3 h.hat4 h.hat5 h.hat6 h.hat7 h.hat8 1 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 2 1.995304 1.917967 2.522316 2.490593 1.280341 1.598115 3.692192 3.765182 3 2.384397 2.628147 2.292006 2.560214 2.275530 1.690068 3.897713 4.170478 4 1.979887 1.974738 2.849395 3.533432 1.953259 1.952233 3.380433 3.409880 5 1.908326 1.907325 2.880534 3.634208 2.055519 2.050408 3.374410 3.391366 6 2.050616 2.039220 3.050393 2.636029 1.788096 1.791312 3.045192 3.012112 7 2.051738 2.043293 2.805642 3.301918 1.821072 1.824991 3.258625 3.275250 8 1.859691 1.847012 2.625220 3.300853 1.487894 1.494217 2.928395 2.949202 9 2.131236 2.124026 2.609223 3.303230 1.838975 1.846415 3.018724 3.046332 10 2.339573 2.332463 2.758558 3.548438 2.042526 2.050204 3.152067 3.182331 h.hat9 h.hat10 h.hat11 h.hat12 h.hat13 h.hat14 h.hat15 h.hat16 1 1.000000 1.000000 1.000000 1.000000 1.0000000 1.0000000 1.0000000 1.000000 2 3.179366 3.235041 3.272656 2.084384 0.7750355 1.0186909 1.2611050 3.260373 3 3.292956 3.044208 3.110893 2.209905 0.5706574 0.9845786 1.0753172 3.336662 4 3.547571 2.456764 2.410802 3.392164 0.9240117 2.8181285 1.4702213 3.541155 5 3.503391 2.364710 2.308533 3.381151 1.1607192 2.8395317 1.8538831 3.621066 6 2.764950 2.666342 2.616170 3.032535 0.9446706 3.0250815 1.4674914 2.639543 7 3.324473 2.476603 2.441131 3.265434 1.0389234 2.7771346 1.3794586 3.304913 8 3.109952 2.371574 2.337788 2.936484 1.1866336 2.6066665 1.2179275 3.281670 9 3.209669 2.405525 2.384785 3.029610 0.6159459 2.5902523 0.9545822 3.297495 10 3.383528 2.587273 2.569932 3.163916 0.5659435 2.7421913 1.0529735 3.534739 h.hat17 h.hat18 h.hat19 h.hat20 h.hat21 h.hat22 h.hat23 h.hat24 1 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 2 1.877204 2.043461 3.974444 2.014686 2.330115 2.746174 1.298579 1.446391 3 2.197324 1.695264 4.179920 2.111580 2.268179 2.534635 1.816275 1.918675 4 1.959355 2.147425 3.520900 2.005522 2.188427 2.500109 1.955409 1.967517 5 1.907447 2.024260 3.468669 1.917791 2.063227 2.419032 2.176813 1.906688 6 2.000651 2.308849 2.835226 2.100943 2.360199 2.713018 1.722466 2.022129 7 2.014195 2.232250 3.320685 2.088348 2.266883 2.510353 1.715502 2.030503 8 1.802578 2.106864 3.058356 1.913511 2.149119 2.402375 1.341026 1.827623 9 2.097912 2.260193 3.167063 2.160864 2.281674 2.425349 1.601941 2.112803 10 2.306540 2.461868 3.325837 2.368545 2.481157 2.603774 1.795006 2.321352 h.hat25 h.hat26 h.hat27 h.hat28 h.hat29 h.hat30 h.hat31 h.hat32 1 1.000000 1.000000 1.000000 1.00000000 1.000000 1.000000 1.000000 1.000000 2 1.905782 1.349662 4.482022 -0.21471998 2.108308 3.692844 3.213070 3.177669 3 2.116085 1.783521 3.429943 0.51818027 2.715286 3.889949 3.612141 3.148702 4 1.968039 1.959271 3.394503 0.35305373 1.999538 3.384077 2.649245 3.391126 5 1.906698 2.168250 3.769249 0.64682192 1.915056 3.376504 2.927721 3.380554 6 2.023415 1.727732 2.713389 0.07148336 2.089937 3.041332 3.767741 3.033683 7 2.031471 1.726403 3.283951 -0.07619645 2.080428 3.260766 3.586416 3.264841 8 1.829098 1.353252 3.508630 1.02791557 1.902026 2.930882 3.606938 2.935758 9 2.113666 1.628718 3.330457 0.71694608 2.154660 3.022091 3.278034 3.028641 10 2.322208 1.823320 3.667520 0.13751892 2.362514 3.155721 3.191756 3.162856 h.hat33 h.hat34 h.hat35 h.hat36 h.hat37 h.hat38 h.hat39 h.hat40 1 1.0000000 1.000000 1.000000 1.0000000 1.000000 1.000000 1.000000 1.000000 2 0.2531856 2.634973 3.795155 1.0405260 1.244720 2.084606 2.541107 3.609757 3 1.1858089 2.997277 3.012773 1.0483158 1.818111 1.531864 2.302101 3.731775 4 0.5859984 3.365622 3.256385 1.3461426 1.935202 1.960594 2.638115 3.487801 5 0.6401895 3.789009 3.852657 1.7154770 2.193597 2.096874 2.598834 3.440658 6 0.4013716 2.742909 2.876713 1.3765178 1.706831 1.764507 2.856821 2.899736 7 0.7676415 3.284919 3.299054 1.3076630 1.681569 1.789690 2.621205 3.310697 8 1.1113008 3.541913 3.658232 1.2132485 1.308246 1.438768 2.495008 3.017058 9 0.4725773 3.330280 3.322962 0.8650519 1.518285 1.775376 2.491664 3.126368 10 0.2693278 3.682519 3.727986 0.9357134 1.705772 1.976705 2.658891 3.274912 h.hat41 h.hat42 h.hat43 h.hat44 h.hat45 h.hat46 h.hat47 h.hat48 1 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 2 3.800395 3.721257 2.134662 1.930106 1.930330 1.585737 2.454484 1.274740 3 3.297766 3.916844 2.149066 1.447649 1.475158 2.021384 2.248315 1.464198 4 3.409997 3.480888 3.275650 1.995227 1.947103 1.938361 2.455002 1.794033 5 3.757974 3.435671 3.310904 1.913259 2.025183 1.974167 2.362529 2.143203 6 2.698793 2.911551 3.130516 2.081766 1.808502 1.853298 2.664432 1.644717 7 3.283959 3.308147 3.188109 2.074519 1.844855 1.890627 2.475239 1.567809 8 3.490093 3.009829 2.863656 1.893400 1.526684 1.602782 2.370302 1.246568 9 3.330115 3.118616 2.926139 2.149962 1.882402 1.955045 2.404726 1.262553 10 3.658743 3.265560 3.055046 2.357933 2.087284 2.161826 2.586606 1.423289 h.hat49 h.hat50 beta1 beta2 lambda r1 r2 1 1.000000000 1.0000000 1.967171 0.12097874 10.000000 1.0000000 1.0000000 2 -0.368241261 1.0025223 1.923480 -0.06691208 10.000000 1.0000000 1.0000000 3 -0.001017173 0.6591934 1.962771 0.15519199 10.000000 1.0000000 0.9472336 4 0.352592217 0.6728686 1.911583 0.10706746 10.000000 1.0000000 0.0000000 5 0.636900255 0.7778807 1.945122 0.16173429 10.000000 0.8915445 0.0000000 6 0.037939346 0.5648350 1.954585 0.27670844 10.000000 0.8481174 0.0000000 7 -0.038936898 0.8458688 1.924948 0.19642572 13.731672 0.7457933 0.0000000 8 0.996133850 1.1403614 1.996338 0.24371362 13.731672 0.7457933 0.0000000 9 0.703153111 0.5028965 1.951957 0.07147146 13.731672 0.7457933 0.0000000 10 0.124294972 0.3476430 1.958434 -0.02343454 8.001463 0.5527933 0.0000000 sigsq.eps 1 0.3957579 2 0.3447898 3 0.3932521 4 0.4298794 5 0.4384563 6 0.3353250 7 0.2940275 8 0.3302501 9 0.3493967 10 0.4483726 > > # .diag_par > suppressWarnings(bkmrhat:::.diag_par(list(kmfitbma.start, kmfitbma.start))) Inference for the input samples (2 chains: each with iter = 10; warmup = 5): Q5 Q50 Q95 Mean SD Rhat Bulk_ESS Tail_ESS h.hat1 1.9 2.1 2.3 2.1 0.2 1.61 10 10 h.hat2 1.8 2.0 2.3 2.1 0.2 1.61 10 10 h.hat3 2.6 2.8 3.1 2.8 0.2 1.61 10 10 h.hat4 2.6 3.3 3.5 3.2 0.3 1.61 10 10 h.hat5 1.5 1.8 2.0 1.8 0.2 1.61 10 10 h.hat6 1.5 1.8 2.1 1.8 0.2 1.61 10 10 h.hat7 2.9 3.0 3.3 3.1 0.1 0.84 10 10 h.hat8 2.9 3.0 3.3 3.1 0.1 0.84 10 10 h.hat9 2.8 3.2 3.4 3.2 0.2 0.84 10 10 h.hat10 2.4 2.5 2.7 2.5 0.1 0.84 10 10 h.hat11 2.3 2.4 2.6 2.5 0.1 0.84 10 10 h.hat12 2.9 3.0 3.3 3.1 0.1 0.84 10 10 h.hat13 0.6 0.9 1.2 0.9 0.3 1.61 10 10 h.hat14 2.6 2.7 3.0 2.7 0.2 1.61 10 10 h.hat15 1.0 1.2 1.5 1.2 0.2 1.61 10 10 h.hat16 2.6 3.3 3.5 3.2 0.3 0.84 10 10 h.hat17 1.8 2.0 2.3 2.0 0.2 1.61 10 10 h.hat18 2.1 2.3 2.5 2.3 0.1 0.84 10 10 h.hat19 2.8 3.2 3.3 3.1 0.2 0.84 10 10 h.hat20 1.9 2.1 2.4 2.1 0.2 1.61 10 10 h.hat21 2.1 2.3 2.5 2.3 0.1 0.84 10 10 h.hat22 2.4 2.5 2.7 2.5 0.1 0.84 10 10 h.hat23 1.3 1.7 1.8 1.6 0.2 1.61 10 10 h.hat24 1.8 2.0 2.3 2.1 0.2 1.61 10 10 h.hat25 1.8 2.0 2.3 2.1 0.2 1.61 10 10 h.hat26 1.4 1.7 1.8 1.7 0.2 1.61 10 10 h.hat27 2.7 3.3 3.7 3.3 0.3 1.61 10 10 h.hat28 -0.1 0.1 1.0 0.4 0.4 1.61 10 10 h.hat29 1.9 2.1 2.4 2.1 0.2 1.61 10 10 h.hat30 2.9 3.0 3.3 3.1 0.1 0.84 10 10 h.hat31 3.2 3.6 3.8 3.5 0.2 1.61 10 10 h.hat32 2.9 3.0 3.3 3.1 0.1 0.84 10 10 h.hat33 0.3 0.5 1.1 0.6 0.3 0.84 10 10 h.hat34 2.7 3.3 3.7 3.3 0.3 1.61 10 10 h.hat35 2.9 3.3 3.7 3.4 0.3 1.61 10 10 h.hat36 0.9 1.2 1.4 1.1 0.2 1.61 10 10 h.hat37 1.3 1.7 1.7 1.6 0.2 0.84 10 10 h.hat38 1.4 1.8 2.0 1.7 0.2 0.84 10 10 h.hat39 2.5 2.6 2.9 2.6 0.1 0.84 10 10 h.hat40 2.9 3.1 3.3 3.1 0.2 1.61 10 10 h.hat41 2.7 3.3 3.7 3.3 0.3 1.61 10 10 h.hat42 2.9 3.1 3.3 3.1 0.2 1.61 10 10 h.hat43 2.9 3.1 3.2 3.0 0.1 1.61 10 10 h.hat44 1.9 2.1 2.4 2.1 0.2 1.61 10 10 h.hat45 1.5 1.8 2.1 1.8 0.2 1.61 10 10 h.hat46 1.6 1.9 2.2 1.9 0.2 1.61 10 10 h.hat47 2.4 2.5 2.7 2.5 0.1 0.84 10 10 h.hat48 1.2 1.4 1.6 1.4 0.2 1.61 10 10 h.hat49 0.0 0.1 1.0 0.4 0.4 1.61 10 10 h.hat50 0.3 0.6 1.1 0.7 0.3 1.61 10 10 beta1 1.9 2.0 2.0 2.0 0.0 0.84 10 10 beta2 0.0 0.2 0.3 0.2 0.1 1.61 10 10 lambda 8.0 13.7 13.7 11.8 2.5 0.74 10 10 r1 0.6 0.7 0.8 0.7 0.1 1.08 10 10 r2 0.0 0.0 0.0 0.0 0.0 1.00 10 10 sigsq.eps 0.3 0.3 0.4 0.4 0.1 1.61 10 10 For each parameter, Bulk_ESS and Tail_ESS are crude measures of effective sample size for bulk and tail quantities respectively (an ESS > 100 per chain is considered good), and Rhat is the potential scale reduction factor on rank normalized split chains (at convergence, Rhat <= 1.05). > > # .diag > suppressWarnings(bkmrhat:::.diag(kmfitbma.start)) Inference for the input samples (1 chains: each with iter = 10; warmup = 5): Q5 Q50 Q95 Mean SD Rhat Bulk_ESS Tail_ESS h.hat1 1.9 2.1 2.3 2.1 0.2 1.90 5 5 h.hat2 1.9 2.0 2.3 2.1 0.2 1.90 5 5 h.hat3 2.6 2.8 3.0 2.8 0.2 1.90 5 5 h.hat4 2.8 3.3 3.5 3.2 0.3 1.90 5 5 h.hat5 1.5 1.8 2.0 1.8 0.2 1.90 5 5 h.hat6 1.6 1.8 2.0 1.8 0.2 1.90 5 5 h.hat7 2.9 3.0 3.2 3.1 0.1 0.91 5 5 h.hat8 3.0 3.0 3.3 3.1 0.1 0.91 5 5 h.hat9 2.8 3.2 3.4 3.2 0.2 0.91 5 5 h.hat10 2.4 2.5 2.7 2.5 0.1 0.91 5 5 h.hat11 2.3 2.4 2.6 2.5 0.1 0.91 5 5 h.hat12 3.0 3.0 3.2 3.1 0.1 0.91 5 5 h.hat13 0.6 0.9 1.2 0.9 0.3 1.90 5 5 h.hat14 2.6 2.7 3.0 2.7 0.2 1.90 5 5 h.hat15 1.0 1.2 1.4 1.2 0.2 1.90 5 5 h.hat16 2.8 3.3 3.5 3.2 0.3 0.91 5 5 h.hat17 1.8 2.0 2.3 2.0 0.2 1.90 5 5 h.hat18 2.1 2.3 2.4 2.3 0.1 0.91 5 5 h.hat19 2.9 3.2 3.3 3.1 0.2 0.91 5 5 h.hat20 1.9 2.1 2.3 2.1 0.2 1.90 5 5 h.hat21 2.2 2.3 2.5 2.3 0.1 0.91 5 5 h.hat22 2.4 2.5 2.7 2.5 0.1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 lambda 8.4 13.7 13.7 11.8 2.7 0.76 5 5 r1 0.6 0.7 0.8 0.7 0.1 1.22 5 5 r2 0.0 0.0 0.0 0.0 0.0 1.00 5 5 sigsq.eps 0.3 0.3 0.4 0.4 0.1 1.90 5 5 For each parameter, Bulk_ESS and Tail_ESS are crude measures of effective sample size for bulk and tail quantities respectively (an ESS > 100 per chain is considered good), and Rhat is the potential scale reduction factor on rank normalized split chains (at convergence, Rhat <= 1.05). > > # .predictivemean > suppressWarnings( bkmrhat:::.predictivemean(kmfitbma.start)) [1] 6.141695 6.010501 5.942334 5.910288 6.063811 > suppressWarnings(bkmrhat:::.predictivemean(kmfitbma.start, ptype='sd.fit')) [1] 4.930810 4.830909 4.912690 4.751172 4.833372 > > > #.checkver > bkmrhat:::.checkver(print=TRUE) bkmr package version 0.2.2 [1] TRUE > > > #.add_bkmrfits > bkmrhat:::.add_bkmrfits(list(kmfitbma.start,kmfitbma.start), trim=FALSE) Fitted object of class 'bkmrfit' Iterations: 20 Outcome family: gaussian Model fit on: 2025-11-17 17:57:40.260714 > > > proc.time() user system elapsed 5.89 0.53 6.40