title: Error when predicting new fitted values from R gamlss object
body: <p>I have a gamlss model that I'd like to use to make new y predictions (and confidence intervals) from in order to visualize how well the model fits the real data.  I'd like to make predictions from a new data set of randomized predictor values (rather than the original data), but I'm running into an error message.  Here's some example code:</p>
  
  <pre><code>library(gamlss)    
  
  # example data
  irr &lt;- c(0,0,0,0,0,0.93,1.4,1.4,2.3,1.5)
  lite &lt;- c(0,1,2,2.5)
  blck &lt;- 1:8
  raw &lt;- data.frame(
     css =abs(rnorm(500, mean=0.5, sd=0.1)),
     nit =abs(rnorm(500, mean=0.72, sd=0.5)),
     irr =sample(irr, 500, replace=TRUE),
     lit =sample(lite, 500, replace=TRUE),
     block =factor(sample(blck, 500, replace=TRUE))
  )
  
  # the model
  mod &lt;- gamlss(css~nit + irr + lit + random(block), 
         sigma.fo=~irr*nit + random(block), data=raw, family=BE)
  
  # new data (predictors) for making css predictions
  pred &lt;- data.frame(
  nit =abs(rnorm(500, mean=0.72, sd=0.5)),
  irr =sample(irr, 500, replace=TRUE),
  lit =sample(lite, 500, replace=TRUE),
  block =factor(sample(blck, 500, replace=TRUE))
  )
  
  # make predictions
  predmu &lt;- predict(mod, newdata=pred, what="mu", type="response")
  </code></pre>
  
  <p>This gives the following error:</p>
  
  <pre><code>Error in data[match(names(newdata), names(data))] : 
    object of type 'closure' is not subsettable
  </code></pre>
  
  <p>When I run this on my real data, it gives this slightly different error:</p>
  
  <pre><code>Error in `[.data.frame`(data, match(names(newdata), names(data))) : 
    undefined columns selected
  </code></pre>
  
  <p>When I use <code>predict</code> without <code>newdata</code>, it works fine making predictions on the original data, as in:</p>
  
  <pre><code>predmu &lt;- predict(mod, what="mu", type="response")
  </code></pre>
  
  <p>Am I using predict wrong?  Any suggestions are greatly appreciated!  Thank you.</p>