R Under development (unstable) (2025-08-21 r88668 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. > library(lgcp) Welcome to 'lgcp': Log-Gaussian Cox Process B. M. Taylor & T. M. Davies & B. S. Rowlingson & P. J. Diggle. Type '?lgcp' for details. Type 'lgcpvignette()' to view the basic package vignette. Type 'lgcpbayes()' to view the Bayesian package vignette. Type 'citation("lgcp")' to view the citation for this package. Please see the lgcp package NEWS file for latest additions, changes and bug fixes. Note, RandomFields covariance functions are currently unavailable. > > n <- 100 > accs <- rep(0.5,n) > > mcmcloop <- mcmcLoop(N=n,burnin=floor(n/10),thin=1,progressor=mcmcProgressTextBar) # it is important that this object is named "mcmcloop" > > adsch <- andrieuthomsh(inith=1,alpha=1/2,C=1,targetacceptance=0.574) > > h <- initialiseAMCMC(adsch) > hrec <- h > while(nextStep(mcmcloop)){ + ac <- accs[iteration(mcmcloop)] # it is important that this objects is named "ac" + h <- updateAMCMC(adsch) + hrec <- c(hrec,h) + } | |===== | 11% : Burn-in | |========== | 22% : Burn-in | |=============== | 33% : Burn-in | |==================== | 44% : Burn-in | |========================= | 56% : Burn-in | |============================== | 67% : Burn-in | |=================================== | 78% : Burn-in | |======================================== | 89% : Burn-in | |=============================================| 100% : Burn-in | |= | 1% : Run [12/100] | |= | 2% : Run [13/100] | |== | 3% : Run [14/100] | |== | 4% : Run [15/100] | |=== | 6% : Run [16/100] | |=== | 7% : Run [17/100] | |==== | 8% : Run [18/100] | |==== | 9% : Run [19/100] | |===== | 10% : Run [20/100] | |===== | 11% : Run [21/100] | |====== | 12% : Run [22/100] | |====== | 13% : Run [23/100] | |======= | 15% : Run [24/100] | |======= | 16% : Run [25/100] | |======== | 17% : Run [26/100] | |======== | 18% : Run [27/100] | |========= | 19% : Run [28/100] | |========= | 20% : Run [29/100] | |========== | 21% : Run [30/100] | |========== | 22% : Run [31/100] | |=========== | 24% : Run [32/100] | |=========== | 25% : Run [33/100] | |============ | 26% : Run [34/100] | |============ | 27% : Run [35/100] | |============= | 28% : Run [36/100] | |============= | 29% : Run [37/100] | |============== | 30% : Run [38/100] | |============== | 31% : Run [39/100] | |=============== | 33% : Run [40/100] | |=============== | 34% : Run [41/100] | |================ | 35% : Run [42/100] | |================ | 36% : Run [43/100] | |================= | 37% : Run [44/100] | |================= | 38% : Run [45/100] | |================== | 39% : Run [46/100] | |================== | 40% : Run [47/100] | |=================== | 42% : Run [48/100] | |=================== | 43% : Run [49/100] | |==================== | 44% : Run [50/100] | |==================== | 45% : Run [51/100] | |===================== | 46% : Run [52/100] | |===================== | 47% : Run [53/100] | |====================== | 48% : Run [54/100] | |====================== | 49% : Run [55/100] | |======================= | 51% : Run [56/100] | |======================= | 52% : Run [57/100] | |======================== | 53% : Run [58/100] | |======================== | 54% : Run [59/100] | |========================= | 55% : Run [60/100] | |========================= | 56% : Run [61/100] | |========================== | 57% : Run [62/100] | |========================== | 58% : Run [63/100] | |=========================== | 60% : Run [64/100] | |=========================== | 61% : Run [65/100] | |============================ | 62% : Run [66/100] | |============================ | 63% : Run [67/100] | |============================= | 64% : Run [68/100] | |============================= | 65% : Run [69/100] | |============================== | 66% : Run [70/100] | |============================== | 67% : Run [71/100] | |=============================== | 69% : Run [72/100] | |=============================== | 70% : Run [73/100] | |================================ | 71% : Run [74/100] | |================================ | 72% : Run [75/100] | |================================= | 73% : Run [76/100] | |================================= | 74% : Run [77/100] | |================================== | 75% : Run [78/100] | |================================== | 76% : Run [79/100] | |=================================== | 78% : Run [80/100] | |=================================== | 79% : Run [81/100] | |==================================== | 80% : Run [82/100] | |==================================== | 81% : Run [83/100] | |===================================== | 82% : Run [84/100] | |===================================== | 83% : Run [85/100] | |====================================== | 84% : Run [86/100] | |====================================== | 85% : Run [87/100] | |======================================= | 87% : Run [88/100] | |======================================= | 88% : Run [89/100] | |======================================== | 89% : Run [90/100] | |======================================== | 90% : Run [91/100] | |========================================= | 91% : Run [92/100] | |========================================= | 92% : Run [93/100] | |========================================== | 93% : Run [94/100] | |========================================== | 94% : Run [95/100] | |=========================================== | 96% : Run [96/100] | |=========================================== | 97% : Run [97/100] | |============================================ | 98% : Run [98/100] | |============================================ | 99% : Run [99/100] | |=============================================| 100% : Run [100/100] > > halt <- 1 > haltrec <- halt > itno <- 1 > while(itno<=100){ + itr <- itno + if(itno>floor(n/10)){ + itr <- itno - floor(n/10) + } + halt <- exp(log(halt) + (1/(itr^(1/2)))*(accs[itr]-0.574)) + haltrec <- c(haltrec,halt) + itno <- itno + 1 + } > > print(hrec) [1] 1.0000000 0.9286717 0.8813276 0.8444668 0.8137925 0.7873018 0.7638728 [8] 0.7428038 0.7236219 0.7059909 0.6896619 0.6404695 0.6078180 0.5823966 [15] 0.5612417 0.5429720 0.5268139 0.5122834 0.4990544 0.4868950 0.4756335 [22] 0.4651388 0.4553079 0.4460584 0.4373232 0.4290467 0.4211823 0.4136905 [29] 0.4065375 0.3996941 0.3931348 0.3868374 0.3807822 0.3749518 0.3693307 [36] 0.3639048 0.3586617 0.3535901 0.3486797 0.3439211 0.3393058 0.3348260 [43] 0.3304745 0.3262447 0.3221305 0.3181263 0.3142269 0.3104273 0.3067231 [50] 0.3031100 0.2995842 0.2961419 0.2927796 0.2894942 0.2862826 0.2831419 [57] 0.2800694 0.2770626 0.2741190 0.2712364 0.2684127 0.2656458 0.2629337 [64] 0.2602746 0.2576667 0.2551085 0.2525982 0.2501344 0.2477157 0.2453407 [71] 0.2430080 0.2407165 0.2384648 0.2362519 0.2340767 0.2319380 0.2298349 [78] 0.2277665 0.2257317 0.2237297 0.2217596 0.2198206 0.2179118 0.2160326 [85] 0.2141822 0.2123599 0.2105649 0.2087967 0.2070545 0.2053378 0.2036460 [92] 0.2019784 0.2003346 0.1987139 0.1971160 0.1955402 0.1939860 0.1924531 [99] 0.1909409 0.1894491 0.1879770 > print("") [1] "" > print(haltrec) [1] 1.0000000 0.9286717 0.8813276 0.8444668 0.8137925 0.7873018 0.7638728 [8] 0.7428038 0.7236219 0.7059909 0.6896619 0.6404695 0.6078180 0.5823966 [15] 0.5612417 0.5429720 0.5268139 0.5122834 0.4990544 0.4868950 0.4756335 [22] 0.4651388 0.4553079 0.4460584 0.4373232 0.4290467 0.4211823 0.4136905 [29] 0.4065375 0.3996941 0.3931348 0.3868374 0.3807822 0.3749518 0.3693307 [36] 0.3639048 0.3586617 0.3535901 0.3486797 0.3439211 0.3393058 0.3348260 [43] 0.3304745 0.3262447 0.3221305 0.3181263 0.3142269 0.3104273 0.3067231 [50] 0.3031100 0.2995842 0.2961419 0.2927796 0.2894942 0.2862826 0.2831419 [57] 0.2800694 0.2770626 0.2741190 0.2712364 0.2684127 0.2656458 0.2629337 [64] 0.2602746 0.2576667 0.2551085 0.2525982 0.2501344 0.2477157 0.2453407 [71] 0.2430080 0.2407165 0.2384648 0.2362519 0.2340767 0.2319380 0.2298349 [78] 0.2277665 0.2257317 0.2237297 0.2217596 0.2198206 0.2179118 0.2160326 [85] 0.2141822 0.2123599 0.2105649 0.2087967 0.2070545 0.2053378 0.2036460 [92] 0.2019784 0.2003346 0.1987139 0.1971160 0.1955402 0.1939860 0.1924531 [99] 0.1909409 0.1894491 0.1879770 > print(all(hrec==haltrec)) [1] TRUE > > proc.time() user system elapsed 8.79 0.71 9.51