【问题标题】:What is "linear.predictors" as extractable from stan_glm() object in "rstanarm" package?什么是可从“rstanarm”包中的 stan_glm() 对象中提取的“linear.predictors”?
【发布时间】:2018-03-12 21:31:35
【问题描述】:

我写信是为了了解"linear.predictors" 返回的内容是什么 stan_glm() 对象。

显然,"linear.predictors" 与用户提供的预测器不同(文档没有帮助)。

无论如何,有没有办法从stan_glm() 对象中获取预测值?

这是一个单一的预测变量(即 mom_iq)示例:

library(rstanarm) 
data(kidiq)
d <- kidiq  

fit <-stan_glm(kid_score ~ mom_iq,
           data = d,   
           prior = normal(0, 2.5),  
           prior_intercept = normal(0, 10),  
           prior_aux = cauchy(0, 100)) 


 max(fit$linear.predictors) # 110.5605   # As can be seen, these are not the same

 max(d$mom_iq)              # 138.8931

【问题讨论】:

    标签: r bayesian rstan hierarchical-bayesian rstanarm


    【解决方案1】:

    stanreg-objects 的文档中有哪些不清楚的地方?

    ...
    fitted.values 拟合平均值。对于 GLM,线性预测变量由反向链接函数转换。
    linear.predictors 链接尺度上的线性拟合。对于线性模型,这与 fit.values 相同。
    ...

    【讨论】:

    • @morouzian 您的数据存储在fit$data,条款列在fit$terms;但是为什么不能直接从d获取数据呢?
    • @rnorouzian 您的评论(很遗憾您已删除)询问如何“从stanreg-objects 对象中获取用户的预测值”。显然,这意味着您的数据,不是吗?你到底在追求什么?
    猜你喜欢
    • 1970-01-01
    • 2011-04-28
    • 1970-01-01
    • 1970-01-01
    • 2014-03-02
    • 1970-01-01
    • 1970-01-01
    • 2019-03-26
    • 2011-04-24
    相关资源
    最近更新 更多