[R] Using outer with function predict
Henrique Dallazuanna
wwwhsd at gmail.com
Fri Jan 8 21:02:05 CET 2010
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:
> 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/
>
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
>
--
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40" S 49° 16' 22" O
More information about the R-help
mailing list