Skip to content

Using outer with function predict

2 messages · Etienne Stockhausen, Henrique Dallazuanna

#
Hey everybody,

I have a problem with the combination of the commands outer() and predict(). I want to visualize the solutions of a regression modell in a matrix. Therefore I want to use the command predict for a linear modell as the function inside the command outer. I've made a small example:

          x = 1:10
          y = 11:20
          z = rnorm(10)
          lm.1 = lm(z ~ x*y)
          mat = outer(x,y, predict, lm.1) 

That didn't work, but I don't understand why? Isn't it possible to combine these two commands? I hope my intention becomes clear. 
I'm looking forward for any ideas or hints, that might help me. 
I wish everybody a nice weekend.

Best regards

Etienne
___________________________________________________________
Preisknaller: WEB.DE DSL Flatrate f?r nur 16,99 Euro/mtl.! 
http://produkte.web.de/go/02/
#
Try this:

outer(x, y, FUN = function(x, y)predict(lm.1, data.frame(x, y)))
On Fri, Jan 8, 2010 at 5:49 PM, Etienne Stockhausen <einohr2002 at web.de> wrote: