Search code examples
rbayesianrstanhierarchical-bayesianrstanarm

What is "linear.predictors" as extractable from stan_glm() object in "rstanarm" package?


I'm writing to find out what is "linear.predictors" as returned by stan_glm() object.

Apparently, "linear.predictors" is not the same as the predictor(s) provided by the user (documentation didn't help).

In any case, is there a way to obtain predictor values from a stan_glm() object?

Here is a single predictor (i.e., mom_iq) example:

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

Solution

  • What is unclear from the documentation to stanreg-objects?

    ...
    fitted.values Fitted mean values. For GLMs the linear predictors are transformed by the inverse link function.
    linear.predictors Linear fit on the link scale. For linear models this is the same as fitted.values.
    ...