I'm trying to simulate trend data over a five year period. I want different trend profiles...the simplest being a linear trend. I've been using the following code:
patBdta1 <- NULL for(i in 1:100) patBdta1 <- rbind(patBdta1,c(yr1= mean(rbinom(50,1,.50)), yr2 =mean(rbinom(50,1,.51)), yr3 =mean(rbinom(50,1,.52)), yr4 =mean(rbinom(50,1,.53)), yr5 =mean(rbinom(50,1,.54)))) This code creates 100 data sets each with a 5 yr binomial trend profile with a slope of approximately .01. Now, what I want to do is pass this code (or some code) in such a way that I can simulate various trend slopes (i.e., pass in a loop or vectorize vs. copying/repeating code for each slope). Any guidance is much appreciated. Thanks! Marc Marc W. Zodet, MS Senior Health Statistician Agency for Healthcare Research and Quality [[alternative HTML version deleted]] ______________________________________________ R-help@stat.math.ethz.ch 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.