|
| 1 | +# example_SimASAP.R |
| 2 | +# walks the user through a set of examples |
| 3 | + |
| 4 | +library("simASAP") |
| 5 | +library("ggplot2") # shouldn't need to do this but doesn't seem to work otherwise |
| 6 | + |
| 7 | +# first define where your original ASAP run is located |
| 8 | +base.dir <- "C:\\Users\\chris.legault\\Desktop\\testSimASAP" |
| 9 | +my.asap.name <- "simplelogistic" |
| 10 | + |
| 11 | +# run simASAP with defaults to create 10 data sets |
| 12 | +SimASAP(wd=base.dir, asap.name=my.asap.name, nsim=10) |
| 13 | +# the C:\\Users\\chris.legault\\Desktop\\testSimASAP\\sim directory should have been created |
| 14 | +# in this new directory open up two or more of the simplelogistic_simX.dat files |
| 15 | +# and compare the Fleet-1 Catch Data (lines 164-184) and Index-1 and Index-2 Data (lines 281-322) |
| 16 | +# with each other and the original run to see that they have changed |
| 17 | +# can do this by hand or using the ReadASAP3DatFile function |
| 18 | +datorig <- ReadASAP3DatFile(file.path(base.dir, paste0(my.asap.name, ".dat"))) |
| 19 | +od <- file.path(base.dir, "sim") |
| 20 | +datsim1 <- ReadASAP3DatFile(file.path(od, paste0(my.asap.name, "_sim1.dat"))) |
| 21 | +datsim2 <- ReadASAP3DatFile(file.path(od, paste0(my.asap.name, "_sim2.dat"))) |
| 22 | +rbind(datorig$dat$CAA_mats[[1]][1, ], |
| 23 | + datsim1$dat$CAA_mats[[1]][1, ], |
| 24 | + datsim2$dat$CAA_mats[[1]][1, ]) |
| 25 | +# note the original file has the catch at age in proportions (the first 10 columns), |
| 26 | +# while the simulated files have the catch at age in numbers (which will be converted to proportions by ASAP automatically when the program is run) |
| 27 | + |
| 28 | +# now actually run ASAP for a new set of random errors |
| 29 | +SimASAP(wd=base.dir, asap.name=my.asap.name, nsim=10, runflag=FALSE) |
0 commit comments