R Under development (unstable) (2024-03-14 r86117 ucrt) -- "Unsuffered Consequences" Copyright (C) 2024 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. > library(bfp) > > set.seed(19) > > x1 <- rnorm(n=15) > x2 <- rbinom(n=15, size=20, prob=0.5) > x3 <- rexp(n=15) > > y <- rt(n=15, df=2) > > ## run an exhaustive model space evaluation with a flat model prior and > ## a uniform prior (a = 4) on the shrinkage factor t = g/(1 + g): > test <- BayesMfp(y ~ bfp (x2, max = 4) + uc (x1 + x3), nModels = 100, + method="exhaustive") Starting with computation of every model... 0%______________________________________________________________________________________________100% ------------------------------------------------------------------------------------------------------ Actual number of possible models: 1430 Number of non-identifiable models: 0 Number of saved possible models: 100 > > test <- BayesMfp(y ~ bfp(x2, max=1) + uc (x3), nModels = 100, + method="exhaustive", + priorSpecs=list(a=4, modelPrior="dependent")) Starting with computation of every model... 0%______________________________________________________________________________________________100% ------------------ Actual number of possible models: 18 Number of non-identifiable models: 0 Number of saved possible models: 18 > summary(test) ------------------------------ BayesMfp-Output ------------------------------ Original call: BayesMfp(formula = y ~ bfp(x2, max = 1) + uc(x3), priorSpecs = list(a = 4, modelPrior = "dependent"), method = "exhaustive", nModels = 100) 18 multivariable fractional polynomial model(s) of total (visited/cached)18 for following covariates: fixed: (Intercept) uncertain fixed form: x3 fractional polynomial: shift scale maxDegree cardPowerset x2 0 10 1 8 Distribution of posterior probabilities: normalized frequency Min. :0.01180 Min. :2.147e+09 1st Qu.:0.01291 1st Qu.:2.147e+09 Median :0.01796 Median :2.147e+09 Mean :0.05556 Mean :2.147e+09 3rd Qu.:0.01900 3rd Qu.:2.147e+09 Max. :0.41924 Max. :2.147e+09 Overall inclusion probabilities for covariates in question: x2 x3 0.4295234 0.4056232 Inclusion probabilities for covariates in question for this model selection: x2 x3 0.4295234 0.4056232 Overview: posterior logMargLik logPrior postExpectedg postExpectedShrinkage 1 0.41924386 -20.05230 -1.098612 0.000000 0.0000000 2 0.15123272 -20.37878 -1.791759 2.161904 0.4134860 3 0.12628157 -20.55909 -1.791759 1.198872 0.3644188 4 0.08676832 -20.24121 -2.484907 2.462728 0.4366773 5 0.01907880 -20.50312 -3.737670 1.263542 0.3737383 6 0.01874875 -20.52057 -3.737670 1.243134 0.3708349 7 0.01857390 -20.52994 -3.737670 1.232268 0.3692752 8 0.01839582 -20.53957 -3.737670 1.221163 0.3676709 9 0.01821709 -20.54933 -3.737670 1.209979 0.3660445 10 0.01770112 -20.57807 -3.737670 1.177468 0.3612556 11 0.01739342 -20.59560 -3.737670 1.157923 0.3583312 12 0.01331450 -20.16969 -4.430817 2.628531 0.4485572 13 0.01302628 -20.19158 -4.430817 2.577118 0.4449363 14 0.01287229 -20.20347 -4.430817 2.549431 0.4429633 15 0.01271442 -20.21581 -4.430817 2.520887 0.4409121 16 0.01255479 -20.22844 -4.430817 2.491862 0.4388081 17 0.01208539 -20.26655 -4.430817 2.405537 0.4324385 18 0.01179700 -20.29070 -4.430817 2.351769 0.4283835 R2 x3 x2 1 0.00000000 FALSE 2 0.02751942 TRUE 3 0.07486108 TRUE 1 4 0.07238240 FALSE 1 5 0.09553835 TRUE -2 6 0.08917510 TRUE -1 7 0.08572776 TRUE -0.5 8 0.08216046 TRUE 0 9 0.07852151 TRUE 0.5 10 0.06767167 TRUE 2 11 0.06094471 TRUE 3 12 0.09429545 FALSE -2 13 0.08768733 FALSE -1 14 0.08406092 FALSE -0.5 15 0.08027119 FALSE 0 16 0.07636264 FALSE 0.5 17 0.06439674 FALSE 2 18 0.05667094 FALSE 3 > logPriors <- as.data.frame(test)$logPrior > > sum(exp(logPriors[c(1)])) [1] 0.3333333 > sum(exp(logPriors[c(2, 4, 12:18)])) [1] 0.3333333 > sum(exp(logPriors[c(3, 5:11)])) [1] 0.3333333 > > sum(exp(logPriors[3:4])) / sum(exp(logPriors[3:18])) [1] 0.5 > > test <- BayesMfp(y ~ bfp (x2, max = 4) + uc (x1 + x3), nModels = 100, + method="exhaustive", priorSpecs=list(a=4, modelPrior="sparse")) Starting with computation of every model... 0%______________________________________________________________________________________________100% ------------------------------------------------------------------------------------------------------ Actual number of possible models: 1430 Number of non-identifiable models: 0 Number of saved possible models: 100 > > test <- BayesMfp(y ~ bfp (x2, max = 4) + uc (x1 + x3), nModels = 100, + method="exhaustive", priorSpecs=list(a=4, modelPrior="dependent")) Starting with computation of every model... 0%______________________________________________________________________________________________100% ------------------------------------------------------------------------------------------------------ Actual number of possible models: 1430 Number of non-identifiable models: 0 Number of saved possible models: 100 > > for(index in seq_along(test)) + { + stopifnot(all.equal(getLogPrior(test[index]), + test[[index]]$logP)) + } > > > summary(test) ------------------------------ BayesMfp-Output ------------------------------ Original call: BayesMfp(formula = y ~ bfp(x2, max = 4) + uc(x1 + x3), priorSpecs = list(a = 4, modelPrior = "dependent"), method = "exhaustive", nModels = 100) 100 multivariable fractional polynomial model(s) of total (visited/cached)1430 for following covariates: fixed: (Intercept) uncertain fixed form: x1 + x3 fractional polynomial: shift scale maxDegree cardPowerset x2 0 10 4 9 Distribution of posterior probabilities: normalized frequency Min. :0.0001291 Min. :2.147e+09 1st Qu.:0.0001293 1st Qu.:2.147e+09 Median :0.0001553 Median :2.147e+09 Mean :0.0086947 Mean :2.147e+09 3rd Qu.:0.0001560 3rd Qu.:2.147e+09 Max. :0.4911227 Max. :2.147e+09 Overall inclusion probabilities for covariates in question: x2 x1 + x3 0.3668711 0.3478158 Inclusion probabilities for covariates in question for this model selection: x2 x1 + x3 0.2718200 0.3169195 Overview: posterior logMargLik logPrior postExpectedg postExpectedShrinkage 1 0.4911226972 -20.05230 -1.098612 0.0000000 0.0000000 2 0.1420062274 -20.59997 -1.791759 1.1530845 0.3576019 3 0.1206520888 -20.76293 -1.791759 0.8149581 0.3187223 4 0.1016446390 -20.24121 -2.484907 2.4627279 0.4366773 5 0.0001781642 -20.71141 -8.361241 0.8556935 0.3270760 6 0.0001752323 -20.72801 -8.361241 0.8424141 0.3243830 7 0.0001737159 -20.73670 -8.361241 0.8355193 0.3229734 8 0.0001721940 -20.74550 -8.361241 0.8285809 0.3215468 9 0.0001706878 -20.75428 -8.361241 0.8216960 0.3201233 10 0.0001664557 -20.77939 -8.361241 0.8022545 0.3160594 11 0.0001640211 -20.79412 -8.361241 0.7910054 0.3136776 12 0.0001619740 -20.80668 -8.361241 0.7815103 0.3116494 13 0.0001561248 -20.84346 -8.361241 0.6741634 0.2974372 14 0.0001561199 -20.84349 -8.361241 0.6741436 0.2974322 15 0.0001561132 -20.84354 -8.361241 0.6741162 0.2974254 16 0.0001561077 -20.84357 -8.361241 0.6740941 0.2974199 17 0.0001560965 -20.84364 -8.361241 0.6740484 0.2974086 18 0.0001560886 -20.84369 -8.361241 0.6740161 0.2974006 19 0.0001560805 -20.84375 -8.361241 0.6739830 0.2973924 20 0.0001560765 -20.84377 -8.361241 0.6739670 0.2973884 21 0.0001560683 -20.84382 -8.361241 0.6739336 0.2973801 22 0.0001560638 -20.84385 -8.361241 0.6739151 0.2973755 23 0.0001560621 -20.84386 -8.361241 0.6739082 0.2973738 24 0.0001560433 -20.84399 -8.361241 0.6738317 0.2973548 25 0.0001560235 -20.84411 -8.361241 0.6737511 0.2973348 26 0.0001560062 -20.84422 -8.361241 0.6736805 0.2973172 27 0.0001560019 -20.84425 -8.361241 0.6736630 0.2973129 28 0.0001559990 -20.84427 -8.361241 0.6736514 0.2973100 29 0.0001559883 -20.84434 -8.361241 0.6736076 0.2972991 30 0.0001559827 -20.84437 -8.361241 0.6735848 0.2972935 31 0.0001559676 -20.84447 -8.361241 0.6735233 0.2972782 32 0.0001559500 -20.84458 -8.361241 0.6734519 0.2972604 33 0.0001559163 -20.84480 -8.361241 0.6733144 0.2972263 34 0.0001559163 -20.84480 -8.361241 0.6733144 0.2972263 35 0.0001559090 -20.84485 -8.361241 0.6732847 0.2972189 36 0.0001559062 -20.84486 -8.361241 0.6732734 0.2972161 37 0.0001558806 -20.84503 -8.361241 0.6731689 0.2971901 38 0.0001558507 -20.84522 -8.361241 0.6730474 0.2971599 39 0.0001558060 -20.84551 -8.361241 0.6728652 0.2971146 40 0.0001557946 -20.84558 -8.361241 0.6728188 0.2971031 41 0.0001557885 -20.84562 -8.361241 0.6727941 0.2970969 42 0.0001557600 -20.84580 -8.361241 0.6726777 0.2970680 43 0.0001556801 -20.84632 -8.361241 0.6723525 0.2969871 44 0.0001556586 -20.84645 -8.361241 0.6722647 0.2969653 45 0.0001556488 -20.84652 -8.361241 0.6722250 0.2969554 46 0.0001556482 -20.84652 -8.361241 0.6722224 0.2969548 47 0.0001556444 -20.84654 -8.361241 0.6722068 0.2969509 48 0.0001555162 -20.84737 -8.361241 0.6716844 0.2968209 49 0.0001554916 -20.84753 -8.361241 0.6715842 0.2967959 50 0.0001553650 -20.84834 -8.361241 0.6710682 0.2966675 51 0.0001552891 -20.84883 -8.361241 0.6707586 0.2965904 52 0.0001552614 -20.84901 -8.361241 0.6706459 0.2965623 53 0.0001550108 -20.85062 -8.361241 0.6696239 0.2963075 54 0.0001547857 -20.85208 -8.361241 0.6687055 0.2960784 55 0.0001547609 -20.85224 -8.361241 0.6686044 0.2960531 56 0.0001541692 -20.85607 -8.361241 0.6661885 0.2954493 57 0.0001534646 -20.86065 -8.361241 0.6633087 0.2947276 58 0.0001531287 -20.16969 -9.054388 2.6285306 0.4485572 59 0.0001498140 -20.19158 -9.054388 2.5771180 0.4449363 60 0.0001480429 -20.20347 -9.054388 2.5494306 0.4429633 61 0.0001462272 -20.21581 -9.054388 2.5208875 0.4409121 62 0.0001443913 -20.22844 -9.054388 2.4918620 0.4388081 63 0.0001389928 -20.26655 -9.054388 2.4055375 0.4324385 64 0.0001356761 -20.29070 -9.054388 2.3517690 0.4283835 65 0.0001327062 -20.31283 -9.054388 2.3031405 0.4246558 66 0.0001296348 -21.02940 -8.361241 0.5241709 0.2626473 67 0.0001295336 -21.03018 -8.361241 0.5237781 0.2625292 68 0.0001294423 -21.03088 -8.361241 0.5234236 0.2624225 69 0.0001294262 -21.03101 -8.361241 0.5233609 0.2624036 70 0.0001293895 -21.03129 -8.361241 0.5232186 0.2623608 71 0.0001293622 -21.03150 -8.361241 0.5231126 0.2623289 72 0.0001293467 -21.03162 -8.361241 0.5230524 0.2623107 73 0.0001293141 -21.03187 -8.361241 0.5229255 0.2622725 74 0.0001293006 -21.03198 -8.361241 0.5228732 0.2622568 75 0.0001292795 -21.03214 -8.361241 0.5227912 0.2622321 76 0.0001292647 -21.03226 -8.361241 0.5227339 0.2622148 77 0.0001292572 -21.03231 -8.361241 0.5227044 0.2622060 78 0.0001292568 -21.03232 -8.361241 0.5227031 0.2622056 79 0.0001292482 -21.03238 -8.361241 0.5226698 0.2621955 80 0.0001292265 -21.03255 -8.361241 0.5225853 0.2621701 81 0.0001292145 -21.03264 -8.361241 0.5225387 0.2621560 82 0.0001292111 -21.03267 -8.361241 0.5225254 0.2621520 83 0.0001291991 -21.03276 -8.361241 0.5224787 0.2621379 84 0.0001291984 -21.03277 -8.361241 0.5224761 0.2621372 85 0.0001291953 -21.03279 -8.361241 0.5224642 0.2621336 86 0.0001291905 -21.03283 -8.361241 0.5224456 0.2621280 87 0.0001291814 -21.03290 -8.361241 0.5224102 0.2621173 88 0.0001291727 -21.03297 -8.361241 0.5223763 0.2621071 89 0.0001291682 -21.03300 -8.361241 0.5223589 0.2621019 90 0.0001291584 -21.03308 -8.361241 0.5223206 0.2620903 91 0.0001291575 -21.03309 -8.361241 0.5223172 0.2620893 92 0.0001291554 -21.03310 -8.361241 0.5223091 0.2620869 93 0.0001291531 -21.03312 -8.361241 0.5223001 0.2620841 94 0.0001291484 -21.03316 -8.361241 0.5222817 0.2620786 95 0.0001291425 -21.03320 -8.361241 0.5222591 0.2620718 96 0.0001291410 -21.03321 -8.361241 0.5222531 0.2620700 97 0.0001291403 -21.03322 -8.361241 0.5222503 0.2620691 98 0.0001291397 -21.03322 -8.361241 0.5222479 0.2620684 99 0.0001291319 -21.03328 -8.361241 0.5222177 0.2620593 100 0.0001291271 -21.03332 -8.361241 0.5221989 0.2620536 R2 x1 + x3 x2 1 0.00000000 FALSE 2 0.05925486 TRUE 3 0.09514136 TRUE 1 4 0.07238240 FALSE 1 5 0.11676461 TRUE -2 6 0.10988971 TRUE -1 7 0.10625519 TRUE -0.5 8 0.10255158 TRUE 0 9 0.09882979 TRUE 0.5 10 0.08805967 TRUE 2 11 0.08164496 TRUE 3 12 0.07612128 TRUE 4 13 0.15545876 TRUE 0.5, 0.5 14 0.15544485 TRUE 0, 1 15 0.15542563 TRUE 0.5, 1 16 0.15541004 TRUE 0, 0.5 17 0.15537798 TRUE -0.5, 1 18 0.15535528 TRUE -0.5, 2 19 0.15533205 TRUE -1, 2 20 0.15532080 TRUE 1, 1 21 0.15529734 TRUE 0, 0 22 0.15528436 TRUE 0, 2 23 0.15527947 TRUE -0.5, 0.5 24 0.15522576 TRUE -1, 1 25 0.15516910 TRUE -1, 3 26 0.15511945 TRUE 0.5, 2 27 0.15510718 TRUE -0.5, 0 28 0.15509899 TRUE -2, 3 29 0.15506821 TRUE -1, 0.5 30 0.15505222 TRUE -0.5, 3 31 0.15500898 TRUE -2, 2 32 0.15495872 TRUE -2, 4 33 0.15486202 TRUE 1, 2 34 0.15486197 TRUE -0.5, -0.5 35 0.15484112 TRUE -1, 0 36 0.15483317 TRUE 0, 3 37 0.15475963 TRUE -1, 4 38 0.15467406 TRUE -2, 1 39 0.15454578 TRUE -1, -0.5 40 0.15451309 TRUE 0.5, 3 41 0.15449572 TRUE -0.5, 4 42 0.15441373 TRUE -2, 0.5 43 0.15418446 TRUE -1, -1 44 0.15412251 TRUE 0, 4 45 0.15409451 TRUE 1, 3 46 0.15409268 TRUE -2, 0 47 0.15408172 TRUE 2, 2 48 0.15371296 TRUE -2, -0.5 49 0.15364217 TRUE 0.5, 4 50 0.15327740 TRUE -2, -1 51 0.15305832 TRUE 1, 4 52 0.15297851 TRUE 2, 3 53 0.15225400 TRUE -2, -2 54 0.15160138 TRUE 2, 4 55 0.15152948 TRUE 3, 3 56 0.14980539 TRUE 3, 4 57 0.14773720 TRUE 4, 4 58 0.09429545 FALSE -2 59 0.08768733 FALSE -1 60 0.08406092 FALSE -0.5 61 0.08027119 FALSE 0 62 0.07636264 FALSE 0.5 63 0.06439674 FALSE 2 64 0.05667094 FALSE 3 65 0.04949198 FALSE 4 66 0.15781394 TRUE 4, 4, 4 67 0.15741695 TRUE 3, 4, 4 68 0.15705828 TRUE 3, 3, 4 69 0.15699471 TRUE 2, 4, 4 70 0.15685063 TRUE -2, -2, -2 71 0.15674319 TRUE 3, 3, 3 72 0.15668213 TRUE 2, 3, 4 73 0.15655348 TRUE 1, 4, 4 74 0.15650049 TRUE -2, -2, -1 75 0.15641724 TRUE 2, 3, 3 76 0.15635911 TRUE 2, 2, 4 77 0.15632921 TRUE -2, -2, -0.5 78 0.15632784 TRUE 0.5, 4, 4 79 0.15629405 TRUE 1, 3, 4 80 0.15620831 TRUE -2, -1, -1 81 0.15616094 TRUE -2, -2, 0 82 0.15614748 TRUE 2, 2, 3 83 0.15610001 TRUE 0, 4, 4 84 0.15609736 TRUE 0.5, 3, 4 85 0.15608529 TRUE 1, 3, 3 86 0.15606643 TRUE -2, -1, -0.5 87 0.15603045 TRUE 1, 2, 4 88 0.15599604 TRUE -2, -2, 0.5 89 0.15597838 TRUE -1, -1, -1 90 0.15593944 TRUE -2, -0.5, -0.5 91 0.15593594 TRUE 2, 2, 2 92 0.15592776 TRUE -2, -1, 0 93 0.15591861 TRUE 0.5, 3, 3 94 0.15589988 TRUE 0, 3, 4 95 0.15587693 TRUE 1, 2, 3 96 0.15587084 TRUE -0.5, 4, 4 97 0.15586799 TRUE -1, -1, -0.5 98 0.15586555 TRUE 0.5, 2, 4 99 0.15583482 TRUE -2, -2, 1 100 0.15581576 TRUE -2, -0.5, 0 > ## setting > > beta0 <- 1 > alpha1 <- 1 > alpha2 <- 3 > delta1 <- 1 > > sigma <- 2 # sigma2 = 4 > n <- 15 > k <- 2L > > ## simulate data > > set.seed (123) > > x <- matrix (runif (n * k, 1, 4), nrow = n, ncol = k) # predictor values > w <- matrix (rbinom (n * 1, size = 1, prob = 0.5), nrow = n, ncol = 1) > > x1tr <- alpha1 * x[,1]^2 > x2tr <- alpha2 * (x[,2])^(1/2) > w1tr <- delta1 * w[,1] > > predictorTerms <- + x1tr + + x2tr + + w1tr > > trueModel <- list (powers = list (x1 = 2, x2 = 0.5), + ucTerms = as.integer (1) + ) > > covariateData <- data.frame (x1 = x[,1], + x2 = x[,2], + w = w) > > covariateData$y <- predictorTerms + rnorm (n, 0, sigma) > covariateData x1 x2 w y 1 1.862733 3.699475 1 8.068580 2 3.364915 1.738263 1 16.107105 3 2.226931 1.126179 1 11.284089 4 3.649052 1.983762 1 18.250178 5 3.821402 3.863511 0 18.168767 6 1.136669 3.668618 0 5.401077 7 2.584316 3.078410 1 14.312183 8 3.677257 2.921520 0 18.009844 9 2.654305 3.982809 0 10.409384 10 2.369844 2.967117 0 9.584542 11 3.870500 3.125591 0 20.025752 12 2.360002 2.632198 0 12.210299 13 3.032712 2.782426 0 13.898731 14 2.717900 1.867479 0 12.146236 15 1.308774 1.441341 0 -1.140080 > > ## also test the dependent model prior > dependent <- BayesMfp (y ~ bfp (x1, max=1) + bfp(x2, max=1), + data = covariateData, + priorSpecs = + list (a = 3.5, + modelPrior="dependent"), + method = "exhaustive", + nModels = 10000) Starting with computation of every model... 0%______________________________________________________________________________________________100% --------------------------------------------------------------------------------- Actual number of possible models: 81 Number of non-identifiable models: 0 Number of saved possible models: 81 > attr(dependent, "logNormConst") [1] 8.012593 > > depSum <- as.data.frame(dependent) > depSum posterior logMargLik logPrior postExpectedg postExpectedShrinkage 1 5.399373e-01 -33.14837 -2.484907 172.127635 0.9650484 2 1.439563e-01 -34.75800 -2.197225 54.008347 0.9476502 3 8.850220e-02 -33.01089 -4.430817 177.014280 0.9660069 4 4.632037e-02 -33.65833 -4.430817 154.984283 0.9612121 5 1.403699e-02 -34.85222 -4.430817 120.293438 0.9501499 6 1.388565e-02 -34.86306 -4.430817 120.010068 0.9500336 7 1.269060e-02 -34.54759 -4.836282 56.655348 0.9500465 8 1.058551e-02 -34.72896 -4.836282 54.367358 0.9479886 9 1.050158e-02 -34.73692 -4.836282 54.268730 0.9478961 10 1.050050e-02 -34.73703 -4.836282 54.267458 0.9478949 11 1.025336e-02 -34.76084 -4.836282 53.973251 0.9476169 12 9.670482e-03 -34.81937 -4.836282 53.255884 0.9469267 13 9.484894e-03 -34.83875 -4.836282 53.020117 0.9466958 14 9.110389e-03 -34.87903 -4.836282 52.532730 0.9462123 15 7.551659e-03 -35.06668 -4.836282 50.310759 0.9438922 16 3.728895e-03 -34.51957 -6.089045 57.015785 0.9503560 17 3.705466e-03 -34.52588 -6.089045 56.934522 0.9502866 18 3.684640e-03 -34.53151 -6.089045 56.861938 0.9502244 19 3.576731e-03 -34.56124 -6.089045 56.480423 0.9498949 20 3.560730e-03 -36.22395 -4.430817 88.319723 0.9324439 21 3.379891e-03 -34.61784 -6.089045 55.759777 0.9492606 22 3.256995e-03 -34.65488 -6.089045 55.292404 0.9488406 23 3.133024e-03 -34.69369 -6.089045 54.806220 0.9483963 24 2.620685e-03 -36.12501 -4.836282 39.151656 0.9284092 25 2.370699e-03 -36.63073 -4.430817 80.196740 0.9257735 26 2.228077e-03 -35.03455 -6.089045 50.685697 0.9442976 27 2.209194e-03 -35.04306 -6.089045 50.586171 0.9441905 28 2.207283e-03 -35.04392 -6.089045 50.576059 0.9441796 29 2.148037e-03 -35.07113 -6.089045 50.259019 0.9438358 30 2.002441e-03 -35.14132 -6.089045 49.448639 0.9429375 31 1.975199e-03 -36.40778 -4.836282 36.528163 0.9234563 32 1.958937e-03 -35.16328 -6.089045 49.197238 0.9426530 33 1.843054e-03 -35.22426 -6.089045 48.504744 0.9418545 34 7.810091e-04 -36.08285 -6.089045 39.554905 0.9291147 35 7.804454e-04 -36.08358 -6.089045 39.547972 0.9291027 36 7.747661e-04 -37.34364 -4.836282 28.775501 0.9038789 37 7.695406e-04 -36.09765 -6.089045 39.413044 0.9288681 38 7.672200e-04 -36.10067 -6.089045 39.384132 0.9288176 39 7.127536e-04 -36.17430 -6.089045 38.684221 0.9275737 40 6.936301e-04 -36.20150 -6.089045 38.428164 0.9271078 41 6.390573e-04 -36.28345 -6.089045 37.664539 0.9256825 42 5.842642e-04 -36.37309 -6.089045 36.842569 0.9240853 43 5.822375e-04 -36.37656 -6.089045 36.810984 0.9240226 44 5.799165e-04 -36.38056 -6.089045 36.774704 0.9239504 45 5.748502e-04 -36.38933 -6.089045 36.695098 0.9237916 46 5.572545e-04 -36.42042 -6.089045 36.414119 0.9232256 47 5.431756e-04 -36.44601 -6.089045 36.184065 0.9227560 48 5.304523e-04 -36.46971 -6.089045 35.971957 0.9223179 49 3.897493e-04 -38.03070 -4.836282 23.889874 0.8855783 50 3.633970e-04 -38.50617 -4.430817 49.243080 0.8817838 51 2.361060e-04 -37.27916 -6.089045 29.267119 0.9054076 52 2.350428e-04 -37.28367 -6.089045 29.232517 0.9053015 53 2.337752e-04 -37.28908 -6.089045 29.191097 0.9051743 54 2.285609e-04 -37.31164 -6.089045 29.018761 0.9046413 55 2.238666e-04 -37.33239 -6.089045 28.860862 0.9041478 56 2.047384e-04 -37.42171 -6.089045 28.188219 0.9019881 57 1.893843e-04 -37.49966 -6.089045 27.610277 0.9000549 58 1.158947e-04 -37.99076 -6.089045 24.157026 0.8867523 59 1.156623e-04 -37.99277 -6.089045 24.143550 0.8866937 60 1.145849e-04 -38.00212 -6.089045 24.080800 0.8864197 61 1.137551e-04 -38.00939 -6.089045 24.032140 0.8862064 62 1.130067e-04 -38.01599 -6.089045 23.988005 0.8860123 63 1.104215e-04 -43.02957 -1.098612 0.000000 0.0000000 64 1.091266e-04 -38.05093 -6.089045 23.755309 0.8849780 65 1.090242e-04 -38.05187 -6.089045 23.749081 0.8849501 66 1.008450e-04 -39.38262 -4.836282 15.931292 0.8353770 67 3.243301e-05 -39.26426 -6.089045 16.550139 0.8407284 68 3.219984e-05 -39.27148 -6.089045 16.512016 0.8404083 69 3.192271e-05 -39.28012 -6.089045 16.466412 0.8400238 70 3.106622e-05 -39.30732 -6.089045 16.323409 0.8388066 71 2.998654e-05 -39.34269 -6.089045 16.138513 0.8372065 72 2.656522e-05 -39.46384 -6.089045 15.514571 0.8315777 73 2.475422e-05 -39.53444 -6.089045 15.157481 0.8281877 74 1.739081e-05 -43.49164 -2.484907 4.197792 0.4527453 75 2.929596e-06 -43.32680 -4.430817 4.907128 0.4802698 76 2.815324e-06 -43.36659 -4.430817 4.730201 0.4737063 77 2.727892e-06 -43.39814 -4.430817 4.592484 0.4684647 78 2.636693e-06 -43.43214 -4.430817 4.446607 0.4627791 79 2.553139e-06 -43.46434 -4.430817 4.310915 0.4573615 80 2.398547e-06 -43.52681 -4.430817 4.054568 0.4467646 81 2.368351e-06 -43.53947 -4.430817 4.003677 0.4446015 R2 x1 x2 1 0.8827286457 1 2 0.8871078483 1 1 3 0.8855796032 0.5 4 0.8714956694 0 5 0.8405967510 2 6 0.8402830274 -0.5 7 0.8917304232 0.5 1 8 0.8877578169 1 0 9 0.8875800042 1 -0.5 10 0.8875777082 1 0.5 11 0.8870439046 1 -1 12 0.8857208260 1 2 13 0.8852791905 1 -2 14 0.8843553135 1 3 15 0.8799475721 0 1 16 0.8923307406 0.5 0 17 0.8921959767 0.5 0.5 18 0.8920753199 0.5 -0.5 19 0.8914366613 0.5 -1 20 0.7951978331 -1 21 0.8902094303 0.5 2 22 0.8893985658 0.5 -2 23 0.8885422536 0.5 3 24 0.8515215849 -0.5 1 25 0.7792158329 3 26 0.8807147664 0 0 27 0.8805120742 0 0.5 28 0.8804914426 0 -0.5 29 0.8798409267 0 -1 30 0.8781455016 0 2 31 0.8427662270 2 1 32 0.8776097649 0 -2 33 0.8761093840 0 3 34 0.8527815002 -0.5 0 35 0.8527600186 -0.5 -0.5 36 0.8095636171 -1 1 37 0.8523407163 -0.5 0.5 38 0.8522505566 -0.5 -1 39 0.8500338291 -0.5 -2 40 0.8492061223 -0.5 2 41 0.8466824461 -0.5 3 42 0.8438696580 2 -0.5 43 0.8437595084 2 0 44 0.8436327937 2 -1 45 0.8433540344 2 0.5 46 0.8423621122 2 -2 47 0.8415405432 2 2 48 0.8407754285 2 3 49 0.7802830569 3 1 50 0.6855326620 -2 51 0.8120814915 -1 -0.5 52 0.8119064610 -1 -1 53 0.8116965142 -1 0 54 0.8108179137 -1 0.5 55 0.8100056502 -1 -2 56 0.8064655005 -1 2 57 0.8033161521 -1 3 58 0.7821166185 3 -1 59 0.7820248709 3 -0.5 60 0.7815966083 3 0 61 0.7812633373 3 -2 62 0.7809601732 3 0.5 63 0.0000000000 64 0.7793476545 3 2 65 0.7793041671 3 3 66 0.7064065474 -2 1 67 0.7139258301 -2 -1 68 0.7134740624 -2 -2 69 0.7129317180 -2 -0.5 70 0.7112173058 -2 0 71 0.7089692289 -2 0.5 72 0.7011097381 -2 2 73 0.6964114946 -2 3 74 0.0154525450 1 75 0.0646459314 -2 76 0.0531804586 -1 77 0.0439094354 -0.5 78 0.0337331221 0 79 0.0239151107 0.5 80 0.0043504219 2 81 0.0002953391 3 > > sum(exp(depSum$logPrior)) [1] 1 > > for(index in seq_along(dependent)) + { + stopifnot(all.equal(getLogPrior(dependent[index]), + dependent[[index]]$logP)) + } > > > ## and with sampling: > ## the frequencies must converge to > ## the (normalized) posterior probabilities! > set.seed(93) > dependent2 <- BayesMfp(y ~ bfp (x1, max=1) + bfp(x2, max=1), + data = covariateData, + priorSpecs = + list (a = 3.5, + modelPrior="sparse"), + method = "sampling", + nModels = 10000L, + chainlength=1000000L) Starting sampler... 0%______________________________________________________________________________________________100% ---------------------------------------------------------------------------------------------------- Number of non-identifiable model proposals: 0 Number of total cached models: 81 Number of returned models: 81 > depSum2 <- as.data.frame(dependent2) > depSum2 posterior frequency logMargLik logPrior postExpectedg 1 2.955273e-01 0.297009 -33.01089 -3.465736 177.014280 2 2.575662e-01 0.255865 -33.14837 -3.465736 172.127635 3 1.546734e-01 0.154824 -33.65833 -3.465736 154.984283 4 4.687242e-02 0.046772 -34.85222 -3.465736 120.293438 5 4.636709e-02 0.046417 -34.86306 -3.465736 120.010068 6 1.189002e-02 0.011691 -36.22395 -3.465736 88.319723 7 8.171334e-03 0.008407 -34.51957 -5.545177 57.015785 8 8.119993e-03 0.008324 -34.52588 -5.545177 56.934522 9 8.074356e-03 0.007877 -34.53151 -5.545177 56.861938 10 7.945602e-03 0.007988 -34.54759 -5.545177 56.655348 11 7.916256e-03 0.007675 -36.63073 -3.465736 80.196740 12 7.837888e-03 0.007909 -34.56124 -5.545177 56.480423 13 7.406542e-03 0.007626 -34.61784 -5.545177 55.759777 14 7.137234e-03 0.007017 -34.65488 -5.545177 55.292404 15 6.865568e-03 0.006704 -34.69369 -5.545177 54.806220 16 6.627602e-03 0.006526 -34.72896 -5.545177 54.367358 17 6.575055e-03 0.006541 -34.73692 -5.545177 54.268730 18 6.574379e-03 0.006706 -34.73703 -5.545177 54.267458 19 6.437947e-03 0.006506 -34.75800 -5.545177 54.008347 20 6.419646e-03 0.006485 -34.76084 -5.545177 53.973251 21 6.054704e-03 0.006037 -34.81937 -5.545177 53.255884 22 5.938507e-03 0.005849 -34.83875 -5.545177 53.020117 23 5.704029e-03 0.005888 -34.87903 -5.545177 52.532730 24 4.882509e-03 0.004878 -35.03455 -5.545177 50.685697 25 4.841130e-03 0.005017 -35.04306 -5.545177 50.586171 26 4.836942e-03 0.004766 -35.04392 -5.545177 50.576059 27 4.728106e-03 0.004753 -35.06668 -5.545177 50.310759 28 4.707113e-03 0.004780 -35.07113 -5.545177 50.259019 29 4.388059e-03 0.004533 -35.14132 -5.545177 49.448639 30 4.292728e-03 0.004523 -35.16328 -5.545177 49.197238 31 4.038786e-03 0.003860 -35.22426 -5.545177 48.504744 32 1.711469e-03 0.001671 -36.08285 -5.545177 39.554905 33 1.710233e-03 0.001721 -36.08358 -5.545177 39.547972 34 1.686337e-03 0.001744 -36.09765 -5.545177 39.413044 35 1.681252e-03 0.001512 -36.10067 -5.545177 39.384132 36 1.640815e-03 0.001564 -36.12501 -5.545177 39.151656 37 1.561896e-03 0.001588 -36.17430 -5.545177 38.684221 38 1.519990e-03 0.001471 -36.20150 -5.545177 38.428164 39 1.400402e-03 0.001373 -36.28345 -5.545177 37.664539 40 1.280331e-03 0.001328 -36.37309 -5.545177 36.842569 41 1.275889e-03 0.001291 -36.37656 -5.545177 36.810984 42 1.270803e-03 0.001234 -36.38056 -5.545177 36.774704 43 1.259701e-03 0.001247 -36.38933 -5.545177 36.695098 44 1.236675e-03 0.001290 -36.40778 -5.545177 36.528163 45 1.221143e-03 0.001267 -36.42042 -5.545177 36.414119 46 1.213458e-03 0.001079 -38.50617 -3.465736 49.243080 47 1.190291e-03 0.001159 -36.44601 -5.545177 36.184065 48 1.162410e-03 0.001276 -36.46971 -5.545177 35.971957 49 5.173921e-04 0.000515 -37.27916 -5.545177 29.267119 50 5.150623e-04 0.000505 -37.28367 -5.545177 29.232517 51 5.122847e-04 0.000521 -37.28908 -5.545177 29.191097 52 5.008581e-04 0.000489 -37.31164 -5.545177 29.018761 53 4.905714e-04 0.000465 -37.33239 -5.545177 28.860862 54 4.850823e-04 0.000498 -37.34364 -5.545177 28.775501 55 4.486545e-04 0.000480 -37.42171 -5.545177 28.188219 56 4.150083e-04 0.000437 -37.49966 -5.545177 27.610277 57 2.539665e-04 0.000258 -37.99076 -5.545177 24.157026 58 2.534572e-04 0.000245 -37.99277 -5.545177 24.143550 59 2.510963e-04 0.000226 -38.00212 -5.545177 24.080800 60 2.492778e-04 0.000213 -38.00939 -5.545177 24.032140 61 2.476378e-04 0.000249 -38.01599 -5.545177 23.988005 62 2.440226e-04 0.000232 -38.03070 -5.545177 23.889874 63 2.391351e-04 0.000254 -38.05093 -5.545177 23.755309 64 2.389109e-04 0.000266 -38.05187 -5.545177 23.749081 65 1.053487e-04 0.000089 -43.02957 -1.386294 0.000000 66 7.107225e-05 0.000062 -39.26426 -5.545177 16.550139 67 7.056130e-05 0.000050 -39.27148 -5.545177 16.512016 68 6.995401e-05 0.000065 -39.28012 -5.545177 16.466412 69 6.807713e-05 0.000059 -39.30732 -5.545177 16.323409 70 6.571116e-05 0.000056 -39.34269 -5.545177 16.138513 71 6.313920e-05 0.000043 -39.38262 -5.545177 15.931292 72 5.821383e-05 0.000061 -39.46384 -5.545177 15.514571 73 5.424530e-05 0.000033 -39.53444 -5.545177 15.157481 74 9.782530e-06 0.000010 -43.32680 -3.465736 4.907128 75 9.400952e-06 0.000007 -43.36659 -3.465736 4.730201 76 9.109000e-06 0.000012 -43.39814 -3.465736 4.592484 77 8.804468e-06 0.000008 -43.43214 -3.465736 4.446607 78 8.525462e-06 0.000008 -43.46434 -3.465736 4.310915 79 8.295933e-06 0.000006 -43.49164 -3.465736 4.197792 80 8.009249e-06 0.000006 -43.52681 -3.465736 4.054568 81 7.908419e-06 0.000005 -43.53947 -3.465736 4.003677 postExpectedShrinkage R2 x1 x2 1 0.9660069 0.8855796032 0.5 2 0.9650484 0.8827286457 1 3 0.9612121 0.8714956694 0 4 0.9501499 0.8405967510 2 5 0.9500336 0.8402830274 -0.5 6 0.9324439 0.7951978331 -1 7 0.9503560 0.8923307406 0.5 0 8 0.9502866 0.8921959767 0.5 0.5 9 0.9502244 0.8920753199 0.5 -0.5 10 0.9500465 0.8917304232 0.5 1 11 0.9257735 0.7792158329 3 12 0.9498949 0.8914366613 0.5 -1 13 0.9492606 0.8902094303 0.5 2 14 0.9488406 0.8893985658 0.5 -2 15 0.9483963 0.8885422536 0.5 3 16 0.9479886 0.8877578169 1 0 17 0.9478961 0.8875800042 1 -0.5 18 0.9478949 0.8875777082 1 0.5 19 0.9476502 0.8871078483 1 1 20 0.9476169 0.8870439046 1 -1 21 0.9469267 0.8857208260 1 2 22 0.9466958 0.8852791905 1 -2 23 0.9462123 0.8843553135 1 3 24 0.9442976 0.8807147664 0 0 25 0.9441905 0.8805120742 0 0.5 26 0.9441796 0.8804914426 0 -0.5 27 0.9438922 0.8799475721 0 1 28 0.9438358 0.8798409267 0 -1 29 0.9429375 0.8781455016 0 2 30 0.9426530 0.8776097649 0 -2 31 0.9418545 0.8761093840 0 3 32 0.9291147 0.8527815002 -0.5 0 33 0.9291027 0.8527600186 -0.5 -0.5 34 0.9288681 0.8523407163 -0.5 0.5 35 0.9288176 0.8522505566 -0.5 -1 36 0.9284092 0.8515215849 -0.5 1 37 0.9275737 0.8500338291 -0.5 -2 38 0.9271078 0.8492061223 -0.5 2 39 0.9256825 0.8466824461 -0.5 3 40 0.9240853 0.8438696580 2 -0.5 41 0.9240226 0.8437595084 2 0 42 0.9239504 0.8436327937 2 -1 43 0.9237916 0.8433540344 2 0.5 44 0.9234563 0.8427662270 2 1 45 0.9232256 0.8423621122 2 -2 46 0.8817838 0.6855326620 -2 47 0.9227560 0.8415405432 2 2 48 0.9223179 0.8407754285 2 3 49 0.9054076 0.8120814915 -1 -0.5 50 0.9053015 0.8119064610 -1 -1 51 0.9051743 0.8116965142 -1 0 52 0.9046413 0.8108179137 -1 0.5 53 0.9041478 0.8100056502 -1 -2 54 0.9038789 0.8095636171 -1 1 55 0.9019881 0.8064655005 -1 2 56 0.9000549 0.8033161521 -1 3 57 0.8867523 0.7821166185 3 -1 58 0.8866937 0.7820248709 3 -0.5 59 0.8864197 0.7815966083 3 0 60 0.8862064 0.7812633373 3 -2 61 0.8860123 0.7809601732 3 0.5 62 0.8855783 0.7802830569 3 1 63 0.8849780 0.7793476545 3 2 64 0.8849501 0.7793041671 3 3 65 0.0000000 0.0000000000 66 0.8407284 0.7139258301 -2 -1 67 0.8404083 0.7134740624 -2 -2 68 0.8400238 0.7129317180 -2 -0.5 69 0.8388066 0.7112173058 -2 0 70 0.8372065 0.7089692289 -2 0.5 71 0.8353770 0.7064065474 -2 1 72 0.8315777 0.7011097381 -2 2 73 0.8281877 0.6964114946 -2 3 74 0.4802698 0.0646459314 -2 75 0.4737063 0.0531804586 -1 76 0.4684647 0.0439094354 -0.5 77 0.4627791 0.0337331221 0 78 0.4573615 0.0239151107 0.5 79 0.4527453 0.0154525450 1 80 0.4467646 0.0043504219 2 81 0.4446015 0.0002953391 3 > > > proc.time() user system elapsed 1.25 0.06 1.29