Without intercept: 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_51_test.fst")
model_file <- file.path(path_modelled, "bw-02-nointer.rds")
form_file <- gsub("(\\.rds)$", "-form\\1", model_file)
model_file_burned <- gsub("(\\.rds)$", "-burned\\1", model_file)

bwdata_model <- fst::read_fst(bwdata_file)
model <- readRDS(model_file_burned)
form <- readRDS(form_file)

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, n.iter = 1000, burnin = 0)
#> ---
#> Family: gaussian 
#> Link function: mu = identity, sigma = log
#> *---
#> Formula mu:
#> ---
#> born_weight ~ 0 + marital_status2 + marital_status3 + race2 + 
#>     race3 + race4 + s(municipality, bs = "re") + s(age)
#> -
#> Parametric coefficients:
#>                     Mean     2.5%      50%    97.5% parameters
#> marital_status2  -13.032  -19.913  -13.003   -6.214     -8.597
#> marital_status3 -136.571 -143.258 -136.598 -129.692   -132.177
#> race2             15.259    7.255   15.384   22.903     21.338
#> race3             36.209   28.250   36.207   44.032     42.279
#> race4             57.712   50.075   57.643   65.795     63.793
#> -
#> Acceptance probabilty:
#>         Mean   2.5%    50% 97.5%
#> alpha 0.9996 0.9983 1.0000     1
#> -
#> Smooth terms:
#>                            Mean      2.5%       50%     97.5% parameters
#> s(municipality).tau21 8.439e+06 5.338e+06 8.126e+06 1.321e+07  7.941e+06
#> s(municipality).alpha 1.000e+00 1.000e+00 1.000e+00 1.000e+00         NA
#> s(municipality).edf   4.000e+01 4.000e+01 4.000e+01 4.000e+01  4.000e+01
#> s(age).tau21          7.266e+05 2.378e+05 5.938e+05 1.972e+06  2.289e+05
#> s(age).alpha          1.000e+00 1.000e+00 1.000e+00 1.000e+00         NA
#> s(age).edf            8.610e+00 8.198e+00 8.633e+00 8.880e+00  8.181e+00
#> ---
#> Formula sigma:
#> ---
#> sigma ~ 1
#> -
#> Parametric coefficients:
#>              Mean  2.5%   50% 97.5% parameters
#> (Intercept) 5.295 5.285 5.295 5.304      5.294
#> -
#> Acceptance probabilty:
#>         Mean   2.5%    50% 97.5%
#> alpha 0.9972 0.9769 1.0000     1
#> ---
#> Sampler summary:
#> -
#> runtime = 62.084
#> ---
#> Optimizer summary:
#> -
#> AICc = 268607.7 edf = 54.1805 logLik = -134249.5
#> logPost = -134739 nobs = 20000 runtime = 7.318

Smoothed effects

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 
#>  11.022   0.071  11.109