Displaying 1 result from an estimated 1 matches for "ms_new".
Did you mean:
is_new
2017 Sep 28
3
building random matrices from vectors of random parameters
Thanks for both the mapply and array approaches! However, although
intended to generate the same result, they don't:
# mapply approach
n = 3
sa <- rnorm(n,0.8,0.1)
so <- rnorm(n,0.5,0.1)
m <- rnorm(n,1.2,0.1)
mats = mapply(function(sa1, so1, m1)
matrix(c(0,sa1*m1,so1,sa1),2,2,byrow=T), sa, so, m, SIMPLIFY = FALSE)
print(mats)
[[1]]
????????? [,1]????? [,2]
[1,] 0.0000000