Skip to content
Prev 10503 / 29559 Next

gridded time series analysis

On Wed, Dec 22, 2010 at 12:39 PM, Advait Godbole
<advaitgodbole at gmail.com> wrote:
I'd do this in two steps:

models <- alply( as.array(s_crop) , 1:2, function(x) {
  resp = x[1:120]
  expl = x[121:240]
  lm(resp ~ expl)
}

Then you can access coefficients with

 ldply(models, coef)

and predictions with

 laply(models, predict)

but I think you might need to manipulate the output of predict to get
the matrix shape that you are expecting.

Hadley