Vessel_Fn: Plots impact of vessels and vessel-year combinations on catch...

Usage Arguments Examples

Usage

1
Vessel_Fn(TmbData, Sdreport, FileName_VYplot = NULL)

Arguments

TmbData
Sdreport
FileName_VYplot

Examples

 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
##---- Should be DIRECTLY executable !! ----
##-- ==>  Define data, use random,
##--	or do  help(data=index)  for the standard data sets.

## The function is currently defined as
function (TmbData, Sdreport, FileName_VYplot = NULL) 
{
    attach(TmbData)
    on.exit(detach(TmbData))
    Summary = summary(Sdreport)
    nu_vt = array(NA, dim = c(n_v, n_t, 2, 2))
    for (vI in 1:n_v) {
        for (tI in 1:n_t) {
            Num = (vI - 1) * n_t + tI
            nu_vt[vI, tI, 1, ] = Summary[which(rownames(Summary) == 
                "nu1_vt")[Num], ]
            nu_vt[vI, tI, 2, ] = Summary[which(rownames(Summary) == 
                "nu2_vt")[Num], ]
        }
    }
    if (!is.null(FileName_VYplot)) 
        jpeg(FileName_VYplot, width = 1.5 * n_t, height = 5, 
            res = 200, units = "in")
    par(mfrow = c(2, n_t), mar = c(2, 2, 2, 0), mgp = c(1.25, 
        0.25, 0), tck = -0.02, oma = c(0, 3, 0, 0))
    for (eI in 1:2) {
        for (tI in 1:n_t) {
            plot(x = 1:n_v, y = 1:n_v, type = "n", ylim = range(c(nu_vt[, 
                , eI, 1] + nu_vt[, , eI, 2], nu_vt[, , eI, 1] - 
                nu_vt[, , eI, 2])), xlab = "Vessel", ylab = "Effect", 
                main = Year_Set[tI])
            if (tI == 1) 
                mtext(side = 2, outer = FALSE, line = 2, text = c("Presence/absence", 
                  "Positive catch rate")[eI])
            for (vI in 1:n_v) {
                points(x = vI, y = nu_vt[vI, tI, eI, 1])
                lines(x = rep(vI, 2), y = c(nu_vt[vI, tI, eI, 
                  1] - nu_vt[vI, tI, eI, 2], nu_vt[vI, tI, eI, 
                  1] + nu_vt[vI, tI, eI, 2]))
            }
        }
    }
    if (!is.null(FileName_VYplot)) 
        dev.off()
    Return = list(nu_vt = nu_vt)
    return(Return)
  }

aaronmberger/Geo_dGLMM_habitat documentation built on May 10, 2019, 3:20 a.m.