0

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
rnorouzian
  • 7,397
  • 5
  • 27
  • 72

1 Answers1

0

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.
...

Maurits Evers
  • 49,617
  • 4
  • 47
  • 68
  • @morouzian Your data is stored in `fit$data` and the terms are listed in `fit$terms`; but why can't you get the data directly from `d`? – Maurits Evers Mar 12 '18 at 22:15
  • @rnorouzian Your comment (which you unfortunately deleted) asked how to *"obtain the user's predictor values from a `stanreg-objects` object"*. Obviously this implies your data, doesn't it? What exactly is it that you are after? – Maurits Evers Mar 12 '18 at 22:31