Only covariates with binning: effects
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")
bwdata_file <- file.path(path_processed, "bwdata_41_model.fst")
model_file <- file.path(path_modelled, "bw-muni-01-covs-bin.rds")
form_file <- gsub("(\\.rds)$", "-form\\1", model_file)
# model_file_burned <- gsub("(\\.rds)$", "-burned\\1", model_file)
model_file_burned <- model_file
bwdata_model <- fst::read_fst(bwdata_file)
form <- readRDS(form_file)
model <- readRDS(model_file_burned)
Compute results
model$results <- results.bamlss.default(model)
Fixed effects
summary(model)
#>
#> Call:
#> bamlss(formula = form, data = bwdata_model, cores = 4, combine = FALSE,
#> light = TRUE, binning = TRUE, n.iter = 1000, burnin = 0)
#> ---
#> Family: gaussian
#> Link function: mu = identity, sigma = log
#> *---
#> Formula mu:
#> ---
#> born_weight ~ s(remoteness) + s(prop_tap_toilet)
#> -
#> Parametric coefficients:
#> Mean 2.5% 50% 97.5% parameters
#> (Intercept) 3221 3219 3221 3223 3222
#> -
#> Acceptance probabilty:
#> Mean 2.5% 50% 97.5%
#> alpha 0.9983 0.9918 1.0000 1
#> -
#> Smooth terms:
#> Mean 2.5% 50% 97.5% parameters
#> s(remoteness).tau21 8.282e+04 2.627e+04 6.573e+04 2.338e+05 8.947e+04
#> s(remoteness).alpha 1.000e+00 1.000e+00 1.000e+00 1.000e+00 NA
#> s(remoteness).edf 8.697e+00 8.368e+00 8.714e+00 8.914e+00 8.785e+00
#> s(prop_tap_toilet).tau21 7.741e+05 2.495e+05 6.240e+05 2.144e+06 1.363e+06
#> s(prop_tap_toilet).alpha 1.000e+00 1.000e+00 1.000e+00 1.000e+00 NA
#> s(prop_tap_toilet).edf 8.926e+00 8.836e+00 8.932e+00 8.980e+00 8.968e+00
#> ---
#> Formula sigma:
#> ---
#> sigma ~ 1
#> -
#> Parametric coefficients:
#> Mean 2.5% 50% 97.5% parameters
#> (Intercept) 6.227 6.225 6.227 6.230 6.227
#> -
#> Acceptance probabilty:
#> Mean 2.5% 50% 97.5%
#> alpha 0.9993 0.9942 1.0000 1
#> ---
#> Sampler summary:
#> -
#> runtime = 660.769
#> ---
#> Optimizer summary:
#> -
#> AICc = 4457418 edf = 19.7534 logLik = -2228689
#> logPost = -2228861 nobs = 291479 runtime = 14.758
Smoothed effects
There seems to be a problem with the labels of the random effects plot.
par(mar = c(4, 4, 0.5, 0), mfrow = c(1, 2), cex.axis = 0.7)
plot(model, scale = 0, scheme = 2, spar = FALSE)
Time to execute the task
Only useful when executed with Rscript
.
proc.time()
#> user system elapsed
#> 3.088 0.126 3.233