I do Bayesian statistics programming using loo package in R with Stan.
There wasn’t loo function on the console, though I run the code as follows.
R version is 3.4.1, and the loo package is 2.1.0.

Thank you very much for answering my question, but the loo function isn’t recognized in R with Stan, though I change stan_glm() into stan() , which you say.

Did you get any error message after either of these lines? If you did get an error message, please copy the whole error message here.

print() for loo objects doesn’t have options inc_warmup = T, pars=par. Did you get an error message from this line? If you did get an error message, copy the whole error message here.

What is your question exactly? When you call loo() on a stanfit object (one generated by stan or sampling from the rstan package), then function loo.stanfit() is actually called. If you want to see it you can type rstan:::loo.stanfit. There are other implementation of that function that work for arrays or matrices which are provided by the loo package.

When I type rstan:::loo.stanfit, the loo() error is solved. However, there is another problem about stan function I find today. I will post it to this stan site.