stan_data: Assemble Data for Stan

Description Usage Arguments Value

View source: R/stan_data.R

Description

Assemble list of data to be passed to rstan::stan().

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
stan_data(
  psm,
  X,
  normal_indx,
  gamma_indx,
  L = 1,
  I0_Z = 1,
  I_su = 1,
  I_su_Z = 1,
  I_fa = 1,
  I_fa_Z = 1,
  I_fit = rep(1, nrow(psm)),
  I_lpd = rep(1, nrow(psm))
)

Arguments

psm

A data frame with rows corresponding to observations, including columns named

site

A factor or character vector giving site names. If a character vector, it will be coerced to factor.

ppt_su

A numeric variable giving summer precipitation in mm.

ppt_fa

A numeric variable giving fall precipitation in mm.

n

An integer variable giving the number of carcasss sampled.

n_psm

An integer variable giving the number of pre-spawning mortalities in each sample.

X

A matrix with rows corresponding to sites and columns corresponding to landscape variables, to be modeled as either normal- or gamma-distributed.

normal_indx

An integer vector giving indices of columns of X to be modeled as normally distributed.

gamma_indx

An integer vector giving indices of columns of X to be modeled as gamma-distributed.

L

Integer giving the number of latent landscape factors to fit.

I0_Z

Integer (0/1) indicating whether to include main effects of latent landscape factors on pre-spawning mortality risk.

I_su

Integer (0/1) indicating whether to include a main effect of summer precipitation on pre-spawning mortality risk.

I_su_Z

Integer (0/1) indicating whether to include interactions between summer precipitation and latent landscape factors on pre-spawning mortality risk.

I_fa

Integer (0/1) indicating whether to include a main effect of fall precipitation on pre-spawning mortality risk.

I_fa_Z

Integer (0/1) indicating whether to include interactions between fall precipitation and latent landscape factors on pre-spawning mortality risk.

I_fit

Integer vector (0/1) of length nrow(psm) indicating whether each pre-spawning mortality observation should be included in the likelihood. This may be useful for fitting some observations while simulating from the posterior predictive distribution for others.

I_lpd

Integer vector (0/1) of length nrow(psm) indicating whether to evaluate the log posterior predictive density for each observation.

Value

A named list of data to be passed to SEMPSM::sem_psm().


ebuhle/SEMPSM documentation built on Aug. 8, 2020, 4:05 a.m.