Full model with t-distribution: continue mcmc
Load packages, read data and source custom scripts
rm(list = ls())
library(bamlss)
#> Loading required package: coda
#> Loading required package: colorspace
#> Loading required package: mgcv
#> Loading required package: nlme
#> This is mgcv 1.8-31. For overview type 'help("mgcv-package")'.
#>
#> Attaching package: 'bamlss'
#> The following object is masked from 'package:mgcv':
#>
#> smooth.construct
library(gamlss.dist)
#> Loading required package: MASS
path_proj <- day2day::git_path()
path_data <- file.path(path_proj, "data")
path_processed <- file.path(path_data, "processed")
path_modelled <- file.path(path_data, "modelled")
source(file.path(path_proj, "src", "43-mcmc-continue-light.R"))
source(file.path(path_proj, "src", "45-mcmc-reshape.R"))
source(file.path(path_proj, "src", "46-mcmc-last-sample.R"))
bwdata_model <- fst::read_fst(file.path(path_processed, "bwdata_41_model.fst"))
path_modelled_data <- file.path(path_modelled, "bw-10-full-re-t.rds")
path_modelled_form <- gsub("(\\.rds)$", "-form\\1", path_modelled_data)
path_modelled_continue <- gsub("(\\.rds)$", "-continue\\1", path_modelled_data)
path_modelled_sink <- gsub("\\.rds$", "\\.txt", path_modelled_continue)
bamlss_model <- readRDS(path_modelled_data)
form <- readRDS(path_modelled_form)
Continue with sampling
starting_value <- last_sample(bamlss_model)
{
sink(path_modelled_sink)
bamlss_model <- bamlss(
form, family = TF, data = bwdata_model,
start = starting_value, optimizer = FALSE,
n.iter = 3000, burnin = 0, cores = 4, combine = FALSE, light = TRUE
)
sink()
}
readLines(path_modelled_sink)
#> [1] "Starting the sampler..."
#> [2] "Starting the sampler..."
#> [3] "Starting the sampler..."
#> [4] "Starting the sampler..."
#> [5] ""
#> [6] "| | 0% 1377.51min"
#> [7] "| | 0% 1375.67min"
#> [8] "| | 0% 1377.53min"
#> [9] "| | 0% 1379.36min"
#> [10] "|* | 5% 1306.65min 68.77min"
#> [11] "|* | 5% 1307.16min 68.80min"
#> [12] "|* | 5% 1308.45min 68.87min"
#> [13] "|* | 5% 1310.61min 68.98min"
#> [14] "|** | 10% 1237.93min 137.55min"
#> [15] "|** | 10% 1238.49min 137.61min"
#> [16] "|** | 10% 1238.63min 137.63min"
#> [17] "|** | 10% 1241.19min 137.91min"
#> [18] "|*** | 15% 1172.70min 206.95min"
#> [19] "|*** | 15% 1172.92min 206.99min"
#> [20] "|*** | 15% 1173.72min 207.13min"
#> [21] "|*** | 15% 1175.49min 207.44min"
#> [22] "|**** | 20% 1110.72min 277.68min"
#> [23] "|**** | 20% 1111.22min 277.81min"
#> [24] "|**** | 20% 1111.45min 277.86min"
#> [25] "|**** | 20% 1112.86min 278.21min"
#> [26] "|***** | 25% 1039.40min 346.47min"
#> [27] "|***** | 25% 1040.11min 346.70min"
#> [28] "|***** | 25% 1040.25min 346.75min"
#> [29] "|***** | 25% 1040.93min 346.98min"
#> [30] "|****** | 30% 972.84min 416.93min"
#> [31] "|****** | 30% 973.23min 417.10min"
#> [32] "|****** | 30% 973.77min 417.33min"
#> [33] "|****** | 30% 974.24min 417.53min"
#> [34] "|******* | 35% 904.93min 487.27min"
#> [35] "|******* | 35% 905.37min 487.51min"
#> [36] "|******* | 35% 905.92min 487.81min"
#> [37] "|******* | 35% 906.22min 487.96min"
#> [38] "|******** | 40% 835.06min 556.71min"
#> [39] "|******** | 40% 835.48min 556.98min"
#> [40] "|******** | 40% 835.98min 557.32min"
#> [41] "|******** | 40% 836.24min 557.50min"
#> [42] "|********* | 45% 765.02min 625.93min"
#> [43] "|********* | 45% 765.14min 626.02min"
#> [44] "|********* | 45% 765.56min 626.36min"
#> [45] "|********* | 45% 765.72min 626.50min"
#> [46] "|********** | 50% 695.36min 695.36min"
#> [47] "|********** | 50% 695.37min 695.37min"
#> [48] "|********** | 50% 695.61min 695.61min"
#> [49] "|********** | 50% 695.95min 695.95min"
#> [50] "|*********** | 55% 625.42min 764.40min"
#> [51] "|*********** | 55% 625.45min 764.44min"
#> [52] "|*********** | 55% 625.63min 764.65min"
#> [53] "|*********** | 55% 626.03min 765.14min"
#> [54] "|************ | 60% 557.98min 836.97min"
#> [55] "|************ | 60% 558.17min 837.26min"
#> [56] "|************ | 60% 558.21min 837.32min"
#> [57] "|************ | 60% 558.35min 837.52min"
#> [58] "|************* | 65% 487.88min 906.06min"
#> [59] "|************* | 65% 487.98min 906.25min"
#> [60] "|************* | 65% 488.06min 906.39min"
#> [61] "|************* | 65% 488.21min 906.67min"
#> [62] "|************** | 70% 417.96min 975.23min"
#> [63] "|************** | 70% 418.09min 975.54min"
#> [64] "|************** | 70% 418.13min 975.64min"
#> [65] "|************** | 70% 418.26min 975.94min"
#> [66] "|*************** | 75% 348.09min 1044.26min"
#> [67] "|*************** | 75% 348.18min 1044.55min"
#> [68] "|*************** | 75% 348.26min 1044.77min"
#> [69] "|*************** | 75% 348.34min 1045.01min"
#> [70] "|**************** | 80% 278.34min 1113.35min"
#> [71] "|**************** | 80% 278.39min 1113.54min"
#> [72] "|**************** | 80% 278.46min 1113.84min"
#> [73] "|**************** | 80% 278.52min 1114.08min"
#> [74] "|***************** | 85% 209.30min 1186.03min"
#> [75] "|***************** | 85% 209.36min 1186.39min"
#> [76] "|***************** | 85% 209.40min 1186.59min"
#> [77] "|***************** | 85% 209.43min 1186.75min"
#> [78] "|****************** | 90% 139.89min 1259.01min"
#> [79] "|****************** | 90% 139.92min 1259.31min"
#> [80] "|****************** | 90% 139.94min 1259.46min"
#> [81] "|****************** | 90% 140.00min 1260.02min"
#> [82] "|******************* | 95% 69.99min 1329.84min"
#> [83] "|******************* | 95% 70.01min 1330.12min"
#> [84] "|******************* | 95% 70.03min 1330.48min"
#> [85] "|******************* | 95% 70.06min 1331.08min"
#> [86] "|********************| 100% 0.00sec 1406.92min"
#> [87] ""
#> [88] "|********************| 100% 0.00sec 1407.02min"
#> [89] ""
#> [90] "|********************| 100% 0.00sec 1407.22min"
#> [91] ""
#> [92] "|********************| 100% 0.00sec 1408.01min"
system.time(saveRDS(bamlss_model, file = path_modelled_continue))
#> user system elapsed
#> 46.464 0.173 46.672
Time to execute the task
Only useful when executed with Rscript
.
proc.time()
#> user system elapsed
#> 338260.304 124.857 84933.769