Description Usage Arguments Value Examples
VBGF plot and CI
1 2 3 4 5 | vbgfCI_time(res, CI = 95, agemax = NULL, add_legend = TRUE,
add_max_dens_legend = TRUE, xlab = "Relative time",
ylab = "Length", perm.col = adjustcolor("grey50", 0.1),
perm.lwd = 1, ci.col = 1, ci.lty = 2, ci.lwd = 1, maxd.col = 1,
maxd.lty = 1, maxd.lwd = 2)
|
res |
list of class 'lfqBoot' |
CI |
vector. Confidence interval levels to plot |
agemax |
numeric. Maximum number of years to project. |
add_legend |
logical. Should CI and max. density legend be added (Default: 'add_legend = TRUE'). |
add_max_dens_legend |
logical. Should maximum density line be added (Default: 'add_max_dens_legend = TRUE'). |
xlab |
Label for x-axis |
ylab |
Label for y-axis |
perm.col |
Color for each resample estimate line. See '?par'. |
perm.lwd |
Line width for each resample estimate line. See '?par'. |
ci.col |
Color for CI line. See '?par'. |
ci.lty |
Line type for CI line. See '?par'. |
ci.lwd |
Line width for CI line. See '?par'. |
maxd.col |
Color for maximum density line. See '?par'. |
maxd.lty |
Line type maximum density line. See '?par'. |
maxd.lwd |
Line width maximum density line. See '?par'. |
plot and list containing: 'limCI' - data.frame with CI limits by time, 'inCi' - data.frame with logical values defining whether bootstrapping samples are within each of the defined CIs, 'density' - the multivariate kernel density estimates for each sample, and 'max_dens' is a list with the VBGF parameter combination having the maximum density estimate.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | data(alba_boot)
CIinfo <- vbgfCI_time(
res = alba_boot,
agemax = 2, CI = 95,
perm.col = adjustcolor("grey50",0.2)
)
# plot more CI levels
CIinfo <- vbgfCI_time(
res = alba_boot,
agemax = 2, CI = c(95, 50),
ci.lty = 1, ci.lwd = 2, ci.col = c("red", "orange"),
perm.col = adjustcolor("grey50",0.2)
)
# using output in lfq plot (see ?TropFishR::plot.lfq)
library(TropFishR)
data(alba)
alba <- lfqRestructure(alba, MA = 7)
plot(alba, Fname = "rcounts", ylim=c(0,15))
for(i in seq(nrow(alba_boot$bootRaw))){
x <- as.list(alba_boot$bootRaw[i,])
tmp <- lfqFitCurves(
lfq = alba, par = x,
col = adjustcolor("grey50",0.1), draw = TRUE, lty=1
)
}
for(j in seq(CIinfo$limCI)){
usr <- par()$usr
tmax <- diff(range(CIinfo$limCI[[j]]$t))
date_start <- as.Date(usr[1], origin = "1970-01-01")
yeardec_start <- date2yeardec(date_start)
date_end <- as.Date(usr[2], origin = "1970-01-01")
yeardec_end <- date2yeardec(date_end)
years <- (floor(yeardec_start)-tmax):ceiling(yeardec_end)
for(y in years){
time <- y + CIinfo$limCI[[j]]$t
time <- as.numeric(yeardec2date(time))
lines(time, CIinfo$limCI[[j]]$min, lty = 2, col=2+j)
lines(time, CIinfo$limCI[[j]]$max, lty = 2, col=2+j)
}
tmp <- lfqFitCurves(lfq = alba, par = CIinfo$max_dens,
col = 1, draw = TRUE, lty=1, lwd=2
)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.