SCRdensity: makes a density plot from object of class "scrfit"

Description Usage Arguments Author(s) References Examples

View source: R/SCRdensity.R

Description

This makes a basic density plot given MCMC output from the main fitting functions of SCRbayes (e.g., SCRh.fn, SCRi.fn)

Usage

1
SCRdensity(obj, nx = 30, ny = 30, Xl = NULL, Xu = NULL, Yl = NULL, Yu = NULL, scalein = 1, scaleout = 100000*100, ncolors = 10,opt.ss=FALSE)

Arguments

obj

should be of class scrfit

nx
ny
Xl
Xu
Yl
Yu
scalein
scaleout
ncolors
opt.ss=FALSE

If TRUE the density plot has support on the input state-space grid. If FALSE (default) the binning method is used.

Author(s)

Andy Royle, aroyle@usgs.gov Joshua Goldberg, joshua.goldberg@umontana.edu

References

Modified from the SCR book Royle et al. (2013)

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
data(wolverine)

## make the encounter data file (EDF)
EDF<-wolverine$wcaps
dimnames(EDF)<-list(NULL,c("session","individual","occasion","trapid"))
## grab the trap deployment file (TDF)
TDF<-wolverine$wtraps

## we will fit a model with sex-specific parameters, so grab the sex variable
wsex<-wolverine$wsex

## bundle these into an "scrdata" object along with the state-space grid
grid<-cbind(wolverine$grid2,rep(1,nrow(wolverine$grid2)))
wolv.scrdata<-scrData(TDF,EDF,grid,Xsex=wsex)


## now fit a model using the current development version of
##   the fitting function
test<-SCRh.fn( wolv.scrdata,ni= 1200, burn=200, skip=2,nz=100,theta=1,
Msigma=1, Mb=0, Msex=1, Msexsigma=1, 
coord.scale=5000, area.per.pixel=4, thinstatespace=4)

## make a density plot
SCRdensity(test, scalein=1, scaleout=1000000*100, nx=20,ny=20)

jaroyle/SCRbayes documentation built on May 18, 2019, 4:48 p.m.