update.z: Samples z

Description Usage Arguments Value

View source: R/mixture_gibbs_functions.R

Description

This function samples the cluster assignment for each location (z)

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
## S3 method for class 'z'
update(
  dat,
  nl,
  n.minus.y,
  phi,
  theta,
  ngroup,
  nloc,
  nspp,
  z,
  a.prior,
  b.prior,
  constant
)

Arguments

dat

this matrix has L rows (locations) and S columns (species) and contains the presence-absence data (i.e., number of times a given species was observed at a given location)

nl

this vector has L elements (locations) and contains the number of observation opportunities at each location

n.minus.y

matrix with L rows (e.g., locations) and S columns (e.g., species), calculated as matrix(nl,L,S)-dat

phi

K x S matrix with the probability of observing each species in each group

theta

vector of length K with the probability of each location group

ngroup

maximum number of location groups (K)

nloc

number of locations (L)

nspp

number of species (S)

z

vector of size L containing the current cluster assignment for each location

a.prior

'a' parameter for prior beta distribution

b.prior

'b' parameter for prior beta distribution

constant

constant term used to calculate probability for a new group

Value

this function returns a vector of size L with the cluster assignment of each location


drvalle1/EcoCluster documentation built on Jan. 25, 2022, 12:46 a.m.