[R] Question about the proper use of outer()

Laurent Gautier Laurent.Gautier at lionbioscience.com
Tue Apr 4 14:51:12 CEST 2000


DeaR all,


I do not have a clue with is the following NOT working like I expect to
do...
(and I cannot find any answer at CRAN)...

# This one is for my sample
> x _ seq(3,10)
# This two for parameters
> a _ seq(2,4)
> b _ seq(2,5)
#  This one for the likelihood of a sample
>f _ function(a,b) {
+  prod(dlnorm(x,meanlog=a,sdlog=b))
+ }
>  outer(a,b,f)
             [,1]         [,2]         [,3]         [,4]
[1,] 2.301348e-21 2.301348e-21 2.301348e-21 2.301348e-21
[2,] 2.301348e-21 2.301348e-21 2.301348e-21 2.301348e-21
[3,] 2.301348e-21 2.301348e-21 2.301348e-21 2.301348e-21

# interestingly, the following seems to work:

> f(a[1],b[1])
[1] 1.141655e-12
> f(a[1],b[2])
[1] 4.952102e-14





Any idea ?




Laurent

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list