fitted.secrgam: Get fitted density values from an secrgam model

Description Usage Arguments Value See Also Examples

Description

Get fitted density values for each mak point or average density across the mask.

Usage

1
2
## S3 method for class 'secrgam'
fitted(fit, mask = NULL, type = c("individual", "mean"))

Arguments

fit

a fitted secrgam or secr model

mask

a mask object

type

the type of fitted value required (use type = "individual" for fitted values at each individual mask point, or type = "mean" for the estmated mean density across all mask points).

Value

If se = FALSE a numeric vector of fitted values is returned (or a single value if type = "mean"). If se = TRUE a list is returned with elements lower, estimate and upper.

See Also

plot.secrgam

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
data(Boland.leopards1)
data(Boland.fits1)
op = par(no.readonly = TRUE)

# fitted density values at each mask point
Dhat = fitted(fit1.a3)
par(mfrow = c(1,1))
prep4image(data.frame(x = fit1.a3$mask$x,
                      y = fit1.a3$mask$y,
                      z = Dhat), asp = 1)

# fitted mean density across all mask points
Dhat = fitted(fit1.a3, type = "mean") ; Dhat
M = nrow(fit1.a3$mask) ; M # number of mask points
a = attr(fit1.a3$mask, "a") ; a # area of each mask cell
A = M * a ; A # total area of mask
Nhat = Dhat * A ; Nhat # abundance within mask

david-borchers/secrgam documentation built on May 14, 2019, 9:30 p.m.