You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

BRMS中log链接函数模型的系数尺度及zAge原尺度转换问询

brms中log链接函数的系数解读与尺度转换问题

问题背景

我正在使用brms包拟合模型,但对所得系数/效应的解读存在疑问:当链接函数为log时,系数处于什么尺度?

以下为官方文档示例:

fit1 <- brm(count ~ zAge + zBase * Trt + (1|patient),
            data = epilepsy, family = poisson())

模型输出结果:

#>  Family: poisson 
#>   Links: mu = log 
#> Formula: count ~ zAge + zBase * Trt + (1 | patient) 
#>    Data: epilepsy (Number of observations: 236) 
#>   Draws: 4 chains, each with iter = 2000; warmup = 1000; thin = 1;
#>          total post-warmup draws = 4000
#> 
#> Group-Level Effects: 
#> ~patient (Number of levels: 59) 
#>               Estimate Est.Error l-95% CI u-95% CI Rhat Bulk_ESS Tail_ESS
#> sd(Intercept)     0.58      0.07     0.46     0.73 1.01      768     1579
#> 
#> Population-Level Effects: 
#>            Estimate Est.Error l-95% CI u-95% CI Rhat Bulk_ESS Tail_ESS
#> Intercept      1.77      0.11     1.54     1.99 1.00      753     1511
#> zAge           0.09      0.08    -0.07     0.26 1.00      830     1429
#> zBase          0.70      0.12     0.47     0.95 1.00      678     1389
#> Trt1          -0.26      0.16    -0.59     0.05 1.01      709     1356
#> zBase:Trt1     0.05      0.17    -0.29     0.37 1.01      721     1404
#> 
#> Draws were sampled using sampling(NUTS). For each parameter, Bulk_ESS
#> and Tail_ESS are effective sample size measures, and Rhat is the potential
#> scale reduction factor on split chains (at convergence, Rhat = 1).

问题核心:若要将zAge的效应转换为数据的原尺度,我应该使用exp(zAge)还是直接使用zAge?

解答

  • 系数尺度说明:当使用log链接函数(比如泊松模型的默认设置)时,brms输出的系数处于对数尺度。这意味着每个系数代表自变量每变化一个单位,响应变量的对数均值的变化量。
  • 尺度转换方法:要将系数转换为原尺度(即响应变量均值的变化比例),需要对系数取指数,也就是用exp(系数值)。以示例中的zAge系数0.09为例,exp(0.09)≈1.094,这表示在控制其他变量不变的情况下,标准化年龄zAge每增加1个单位,预期的癫痫发作次数count会增加约9.4%。
  • 注意事项:直接使用zAge的系数值(0.09)只能解释对数尺度上的变化,无法直接对应原数据中响应变量的实际变化幅度。只有取指数后,才能得到原尺度下的乘法效应(比例变化)。

内容的提问来源于stack exchange,提问作者sjoerdgitaar

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.21 20:43:12