Full model with t-distribution: continue 2 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-get-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_continue2 <- gsub("(\\.rds)$", "-continue2\\1", path_modelled_data)
path_modelled_sink <- gsub("\\.rds$", "\\.txt", path_modelled_continue2)
bamlss_model <- readRDS(path_modelled_data)
form <- readRDS(path_modelled_form)
Continue with sampling
starting_value <- get_last_sample(bamlss_model, 3)
{
sink(path_modelled_sink)
bamlss_model <- bamlss(
form, family = TF, data = bwdata_model,
start = starting_value, optimizer = FALSE,
n.iter = 7000, burnin = 0, cores = 3, combine = FALSE, light = TRUE
)
sink()
}
readLines(path_modelled_sink)
#> [1] "Starting the sampler..."
#> [2] "Starting the sampler...Starting the sampler..."
#> [3] ""
#> [4] ""
#> [5] "| | 0% 1007.81min"
#> [6] ""
#> [7] "|| | 0% | 0% 1041.68min1041.68min"
#> [8] "|* | 5% 948.35min 49.91min"
#> [9] "|* | 5% 948.29min 49.91min"
#> [10] "|* | 5% 948.47min 49.92min"
#> [11] "|** | 10% 891.00min 99.00min"
#> [12] "|** | 10% 891.41min 99.05min"
#> [13] "|** | 10% 892.00min 99.11min"
#> [14] "|*** | 15% 837.51min 147.80min"
#> [15] "|*** | 15% 837.92min 147.87min"
#> [16] "|*** | 15% 837.99min 147.88min"
#> [17] "|**** | 20% 790.13min 197.53min"
#> [18] "|**** | 20% 791.32min 197.83min"
#> [19] "|**** | 20% 791.39min 197.85min"
#> [20] "|***** | 25% 742.16min 247.39min"
#> [21] "|***** | 25% 743.03min 247.68min"
#> [22] "|***** | 25% 743.47min 247.82min"
#> [23] "|****** | 30% 691.51min 296.36min"
#> [24] "|****** | 30% 692.16min 296.64min"
#> [25] "|****** | 30% 692.61min 296.83min"
#> [26] "|******* | 35% 642.85min 346.15min"
#> [27] "|******* | 35% 644.10min 346.82min"
#> [28] "|******* | 35% 644.15min 346.85min"
#> [29] "|******** | 40% 592.72min 395.15min"
#> [30] "|******** | 40% 593.78min 395.86min"
#> [31] "|******** | 40% 593.81min 395.87min"
#> [32] "|********* | 45% 543.24min 444.47min"
#> [33] "|********* | 45% 544.05min 445.13min"
#> [34] "|********* | 45% 544.11min 445.18min"
#> [35] "|********** | 50% 493.63min 493.63min"
#> [36] "|********** | 50% 494.23min 494.23min"
#> [37] "|********** | 50% 494.39min 494.39min"
#> [38] "|*********** | 55% 444.56min 543.35min"
#> [39] "|*********** | 55% 445.60min 544.62min"
#> [40] "|*********** | 55% 445.64min 544.68min"
#> [41] "|************ | 60% 395.28min 592.93min"
#> [42] "|************ | 60% 396.14min 594.20min"
#> [43] "|************ | 60% 396.20min 594.30min"
#> [44] "|************* | 65% 346.37min 643.26min"
#> [45] "|************* | 65% 346.98min 644.38min"
#> [46] "|************* | 65% 346.99min 644.42min"
#> [47] "|************** | 70% 296.78min 692.49min"
#> [48] "|************** | 70% 297.26min 693.60min"
#> [49] "|************** | 70% 297.32min 693.74min"
#> [50] "|*************** | 75% 247.41min 742.23min"
#> [51] "|*************** | 75% 247.74min 743.23min"
#> [52] "|*************** | 75% 247.75min 743.25min"
#> [53] "|**************** | 80% 197.91min 791.64min"
#> [54] "|**************** | 80% 198.17min 792.68min"
#> [55] "|**************** | 80% 198.19min 792.77min"
#> [56] "|***************** | 85% 148.46min 841.28min"
#> [57] "|***************** | 85% 148.65min 842.33min"
#> [58] "|***************** | 85% 148.67min 842.44min"
#> [59] "|****************** | 90% 99.02min 891.20min"
#> [60] "|****************** | 90% 99.10min 891.92min"
#> [61] "|****************** | 90% 99.15min 892.34min"
#> [62] "|******************* | 95% 49.53min 941.01min"
#> [63] "|******************* | 95% 49.58min 942.10min"
#> [64] "|******************* | 95% 49.61min 942.53min"
#> [65] "|********************| 100% 0.00sec 991.26min"
#> [66] ""
#> [67] "|********************| 100% 0.00sec 992.40min"
#> [68] ""
#> [69] "|********************| 100% 0.00sec 992.84min"
system.time(saveRDS(bamlss_model, file = path_modelled_continue2))
#> user system elapsed
#> 10.865 0.035 10.896
Time to execute the task
Only useful when executed with Rscript
.
proc.time()
#> user system elapsed
#> 178782.648 35.193 59694.188