# simulation in R

Hello, I am trying to do a simulation process, which consists of making a function to generate data, then fit a correlated model and another uncorrelated model with the generated data, this must be repeated a large number of times, for example 100. With the The code shown below only generates one output and I want it to generate the outputs or summaries of all the models adjusted simultaneously, that is, if there are 100 simulations, they should generate 200 summaries, since they are two models. Can you help me, please.

simul=function(var.v = 1.7, var.w = 2.6, corr = 0, n = 217, mean=52.5576, sd= 20.45235, mu=c(0,0), a0 = c(1.9, -0.01), b0 = c(2.5, -0.02)){
cov = sqrt(var.vvar.w)corr
sigma = matrix(c(var.v, cov, cov, var.w), 2, 2)
library(MASS)
u = mvrnorm(n = n, mu, Sigma=sigma)
x = rnorm(n, mean, sd)
X = cbind( rep(1, length(x)), x)
mu1 = exp(X%
%a0 + u[,1])
mu2 = exp(X%
%b0 + u[,2])
y1 = rpois(n, mu1)
y2 = rpois(n, mu2)
y = c(y1, y2)
y
Xb = c(x, x)
id = c(1:n, 1:n)
time = as.factor(c(rep(1, n), rep(2, n)))

# plot(y1, y2)

datos=data.frame(y,Xb,time,id)
library(MASS)
library(lme4)
fit1=glm(y ~ Xbtime)
fit2<- glmer(y~Xb
time + (time-1 | id) , family = poisson, data=datos)
summary(fit1)
summary(fit2)
}
simul(var.v = 1.7, var.w = 2.6, corr = 0, n = 217, mean=52.5576, sd= 20.45235, mu=c(0,0), a0 = c(1.9, -0.01), b0 = c(2.5, -0.02))
sims = replicate(100, simul(), simplify = FALSE )
sims

strong text
{"ft_lang_label":"__label__en","ft_lang_prob":0.6838414,"math_prob":0.99996483,"size":1412,"snap":"2021-04-2021-17","text_gpt3_token_len":526,"char_repetition_ratio":0.09161932,"word_repetition_ratio":0.15319149,"special_character_ratio":0.41076487,"punctuation_ratio":0.24274406,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.99995697,"pos_list":[0,1,2],"im_url_duplicate_count":[null,null,null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2021-01-26T22:51:20Z\",\"WARC-Record-ID\":\"<urn:uuid:91c30618-2d63-483e-bb6c-815cca3f822e>\",\"Content-Length\":\"19416\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:d9b31439-3319-4ff9-95c7-d87008657aab>\",\"WARC-Concurrent-To\":\"<urn:uuid:6d264142-7f81-498d-af8e-19adefa76d26>\",\"WARC-IP-Address\":\"167.99.20.217\",\"WARC-Target-URI\":\"https://community.rstudio.com/t/simulation-in-r/72661\",\"WARC-Payload-Digest\":\"sha1:WNNQRWCR7YPVMQDREHUSQPZ7GRNRCQ6L\",\"WARC-Block-Digest\":\"sha1:RNP5LBD4PCRZ2JSYYISHQCRXOBQC5ANY\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2021/CC-MAIN-2021-04/CC-MAIN-2021-04_segments_1610704803737.78_warc_CC-MAIN-20210126202017-20210126232017-00595.warc.gz\"}"}