Is the following a correct approach for sigma modelling?
Let’s assume we have a Y variable named hours in lognormal scale. We would like to know how these hours changed in time (variable named year)
Data
set.seed(0)
pi ← 0
mu_log ← 2
sigma_log ← 0.99
N = 1000
hours = (1 - rbinom(N, 1, prob = pi)) * rlnorm(N, mu_log, sigma_log)
year = seq(1,10, 1)
df = data.frame(hours=hours, year=year)
Model
m = brm(bf(hours ~ year, sigma ~ year), data = df, family = lognormal())
Summary
Family: lognormal
Links: mu = identity; sigma = log
Formula: hours ~ year
sigma ~ year
Data: df (Number of observations: 1000)
Samples: 4 chains, each with iter = 2000; warmup = 1000; thin = 1;
total post-warmup samples = 4000
Population-Level Effects:
Estimate Est.Error l-95% CI u-95% CI Rhat Bulk_ESS Tail_ESS
Intercept 2.06 0.07 1.92 2.19 1.00 3742 2379
sigma_Intercept -0.01 0.05 -0.10 0.09 1.00 5050 3068
year -0.01 0.01 -0.03 0.01 1.00 4144 2783
sigma_year -0.00 0.01 -0.02 0.02 1.00 5213 3302
Temporal trend for mean hours
m %>% conditional_effects()
Temporal trend for the standard deviation of hours?
m %>% conditional_effects(dpar = “sigma”)
Can we say that the standard deviation of hours did not change during the observed years, meaning that variation remained unchanged? And am I correct that these hours on the sigma plot is on the original scale of Y variable(hours)?