predsumspeciesRV: Compute predicted distributions of number species detected

Description Usage Arguments Functions Examples

View source: R/numspec_fulldistribution.R

Description

Uses discreteRV to compute distribution of number of species

Usage

 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
predsumspeciesRV(
  fit,
  chains = NULL,
  UseFittedLV = TRUE,
  nLVsim = 100,
  type = "marginal",
  cl = NULL
)

predsumspeciesRV_newdata(
  fit,
  Xocc,
  Xobs = NULL,
  ModelSiteVars = NULL,
  chains = NULL,
  nLVsim = 100,
  type = "marginal",
  cl = NULL
)

sumspeciesRV_raw(
  Xocc,
  Xobs = NULL,
  ModelSite = NULL,
  numspecies,
  nlv,
  draws,
  useLVindraws = TRUE,
  nLVsim = NULL,
  cl = NULL
)

Arguments

fit

A runjags fitted object

chains

The chains of MCMC to use. Default is all chains.

UseFittedLV

If TRUE the fitted LV variables are used, if false then 100 LV values are simulated.

type

If "draws" then a list of distributions for each site and draw is returned If "marginal" then a single distribution for each site is returned and this distribution is marginalised over the draws.

cl

A cluster object created by parallel::makeCluster. If NULL no cluster is used.

Xocc

A matrix of occupancy covariates. Must have a single row. Columns correspond to covariates.

Xobs

A matrix of detection covariates, each row is a visit. If NULL then expected number of species in occupation is returned

theta

A vector of model parameters, labelled according to the BUGS labelling convention seen in runjags

LVvals

A matrix of LV values. Each column corresponds to a LV. To condition on specific LV values, provide a matrix of row 1.

Functions

Examples

1
2
3
4
5
6
fit <- readRDS("./tmpdata/7_3_02_clim_someclimate_year_woody500m_msnm_det1stO.rds")
indata <- readRDS("./private/data/clean/7_2_10_input_data.rds")
det_dist_2060 <- predsumspeciesRV_newdata(fit,
                         Xocc = indata$holdoutdata$Xocc[indata$holdoutdata$Xocc$ModelSiteID == 2060, , drop = FALSE],
                         Xobs = indata$holdoutdata$yXobs[indata$holdoutdata$yXobs$ModelSiteID == 2060, , drop = FALSE],
                         ModelSiteVars = "ModelSiteID")

sustainablefarms/linking-data documentation built on Oct. 28, 2020, 2:41 a.m.