plot_fit: Plot a gibbonsecr fitted model

Description Usage Arguments Author(s) Examples

Description

Plotting methods for gibbonsecr fitted model objects.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
## S3 method for class 'gsecr'
plot(x, which = c("detfunc", "detsurf", "bearings",
  "distances", "densurf", "locations"), session = 1, ci = FALSE,
  level = 0.95, method = c("delta", "boot"), nboot = 999,
  newdata = NULL, add = FALSE, ...)

geom_fit(x, which = c("detfunc", "detsurf", "bearings", "distances",
  "densurf"), session = 1, ci = FALSE, level = 0.95,
  method = c("delta", "boot"), nboot = 999, contour = FALSE,
  newdata = NULL, ...)

Arguments

x

a gsecr object

which

plot type

session

session to plot (integer or session name)

ci

if TRUE, confidence intervals will be plotted

level

confidence level for confidence intervals

method

confidence interval estimation method

nboot

number of bootstrap samples to use when method = "boot"

newdata

optional dataframe of covariate values

add

if TRUE, adds to existing plot

...

additional arguments to be passed to the underlying plotting method (see Details)

contour

if TRUE, a contour plot will be drawn instead of a heatmap (for which = "detsurf" or which = "densurf")

Author(s)

Darren Kidney [email protected]

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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
## Not run: 

data(N.annamensis)
fit = N.annamensis.fit

# plot methods -----------------------------------------------------------------

# > detection function ----

par(mfrow = c(1,1), mar = c(4,4,2,1))
plot(fit)
plot(fit, ci = TRUE)
plot(fit, ci = TRUE, method = "boot")

# > bearing error ----

plot(fit, "bearings")
plot(fit, "bearings", ci = TRUE)
plot(fit, "bearings", ci = TRUE, method = "boot")

# > detection surface ----

plot(fit, "detsurf", session = 1)
points(fit$capthist, session = 1)

# > density surface ----

plot(fit, "densurf")

# ggplot methods ---------------------------------------------------------------

# > detection function ----

ggplot() +
    geom_fit(fit) +
    labs(x = "Radial distance (m)", y = "Detection probability")

ggplot() +
    geom_fit(fit) +
    geom_fit(fit, ci = TRUE) +
    labs(x = "Radial distance (m)", y = "Detection probability")

ggplot() +
    geom_fit(fit) +
    geom_fit(fit, ci = TRUE, method = "boot") +
    labs(x = "Radial distance (m)", y = "Detection probability")

# > bearing error ----

ggplot() +
    geom_fit(fit, "bearings") +
    labs(x = "Bearing error (degrees)", y = "Probability density")

ggplot() +
    geom_fit(fit, "bearings") +
    geom_fit(fit, "bearings", ci = TRUE) +
    labs(x = "Bearing error (degrees)", y = "Probability density")

ggplot() +
    geom_fit(fit, "bearings") +
    geom_fit(fit, "bearings", ci = TRUE, method = "boot") +
    labs(x = "Radial distance (m)", y = "Detection probability")

# > detection surface ----

ggplot() + coord_fixed() +
    geom_fit(fit, "detsurf", session = 1) +
    geom_fit(fit, "detsurf", session = 1, contour = TRUE) +
    geom_capthist(fit$capthist, session = 1) +
    scale_fill_distiller(palette = "Spectral", limits = c(0, 1)) +
    labs(x = "Longitude", y = "Latitude")

# > density surface ----

ggplot() + coord_fixed() +
    geom_fit(fit, "densurf") +
    geom_capthist(fit$capthist, "array") +
    scale_fill_distiller(palette = "Spectral") +
    labs(x = "Longitude", y = "Latitude")

## End(Not run)

dkidney/gibbonsecr documentation built on May 15, 2019, 9:11 a.m.