Just curious, essentially, i'm trying to implement my function x which is a Poisson Monte Carlo into a 1000*50 matrix, Would be something like this?
n <-50 # sample size=50 for each simulated data set
nsim <-1000 # 1000 simulation runs
x <- function(lambda) rpois(n,rate=lambda)
data.sim<- matrix(x, nrow=nsim, ncol=n)
error code:
Error in as.vector(x, mode) :
cannot coerce type 'closure' to vector of type 'any'
or should i simply make up a function for lambda such as
y <- function(z) z
x <- rpois(n,rate=y)
data.sim<- matrix(x, nrow=nsim, ncol=n)