> How can I modify my R codes to simulate the sample size, the presence of Y-outliers and the presence of missing data ?
I don't know what it means for data to have 50% Y-outliers. That's new to me... As for the rest of your question. Modify your code so that a single function, say sim.test() computes your simulated statistics, for n sample size and m missing values, and returns the results, say as a two-element list. Then write a top level script (or function), something like: + ns = c (50, 100, 200, 300, 500) + ms = (1:5) * 0.1 + n = rep (ns, each=5) + m = rep (ms, times=5) + GAM.stat = MARS.stat = numeric (25) + for (i in 1:25) + { results = sim.test (n [i], m [i], ...other.args...) + GAM.stat [i] = results$GAM.stat + MARS.stat [i] = results$MARS.stat + } + cbind (n, m, GAM.stat, MARS.stat) Note that from past experience, what you are doing may produce misleading results. Because your results are dependent on your simulated data. (Different simulated data will produce different results, and different end conclusions). I haven't checked how the functions, you've used to fit models, handle missing values. But assuming that missing values are NAs, this should be easy to do. Do you want *each* x variable to have m% missing values, or *all* the x variables (collectively), to have m% missing values? [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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.