title: What does `train.error` actually represent for gbm?
body: <p>Consider the short R script below. It seems that <code>boost.hitters$train.error</code> does not match up with either the raw residuals or the squared errors of the training set. </p>
  
  <p>I could not find documentation on <code>train.error</code> at all, so I am wondering if anyone knows what <code>train.error</code> really represents here and how it is computed?</p>
  
  <pre><code>library(ISLR)
  library(gbm)
  
  set.seed(1)
  
  Hitters=na.omit(Hitters)
  Hitters$Salary = log(Hitters$Salary)
  
  boost.hitters=gbm(Salary~.,data=Hitters, n.trees=1000,interaction.depth=4, shrinkage= 0.01)
  yhat.boost=predict(boost.hitters,newdata=Hitters,n.trees=1000)
  
  mean(boost.hitters$train.error^2)
  mean(boost.hitters$train.error)
  
  mean((yhat.boost-Hitters$Salary)^2)
  </code></pre>
  
  <p>Output:</p>
  
  <pre><code>[1] 0.03704581
  [1] 0.1519719
  [1] 0.07148612
  </code></pre>