Well, the obvious (but perhaps not the most elegant) solution is put everything in a loop and run it 600 times.
coefficients=matrix(NA,ncol=3,nrow=600) for (loop in 1:600){ [all your code here] coefficients[loop,]=coef(log_v) } That will give you a matrix with the coefficients of each model run in each row. Julian sigalit mangut-leiba wrote: > I want to repeat the simulation 600 times and to get a vector of 600 > coefficients for every covariate: aps and tiss. > Sigalit. > > > On 11/13/07, Julian Burgos <[EMAIL PROTECTED]> wrote: >> And what is your question? >> >> Julian >> >> sigalit mangut-leiba wrote: >>> Hello, >>> I have a simple (?) simulation problem. >>> I'm doing a simulation with logistic model and I want to reapet it 600 >>> times. >>> The simulation looks like this: >>> >>> z <- 0 >>> x <- 0 >>> y <- 0 >>> aps <- 0 >>> tiss <- 0 >>> for (i in 1:500){ >>> z[i] <- rbinom(1, 1, .6) >>> x[i] <- rbinom(1, 1, .95) >>> y[i] <- z[i]*x[i] >>> if (y[i]==1) aps[i] <- rnorm(1,mean=13.4, sd=7.09) else aps[i] <- >>> rnorm(1,mean=12.67, sd=6.82) >>> if (y[i]==1) tiss[i] <- rnorm(1,mean=20.731,sd=9.751) else tiss[i] <- >>> rnorm(1,mean=18.531,sd=9.499) >>> } >>> v <- data.frame(y, aps, tiss) >>> log_v <- glm(y~., family=binomial, data=v) >>> summary(log_v) >>> >>> I want to do a repetition of this 600 times (I want to have 600 logistic >>> models), and see all the coefficients of the covariates aps & tiss. >>> Thanks in advance, >>> Sigalit. >>> >>> [[alternative HTML version deleted]] >>> >>> ______________________________________________ >>> R-help@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. >> > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help@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. ______________________________________________ R-help@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.