| run_eDITH_single {eDITH} | R Documentation | 
Run eDITH for a single parameter set
Description
Function that runs the eDITH model for a given parameter set
Usage
run_eDITH_single(param, river, covariates,  Z.normalize = TRUE, 
				no.det = FALSE, ll.type = NULL, 
				data = NULL, source.area = "AG",
                tau.prior = list(spec="lnorm",a=0,b=Inf, 
					meanlog=log(5), sd=sqrt(log(5)-log(4))),
                log_p0.prior = list(spec="unif",min=-20, max=0),
                    beta.prior = list(spec="norm",sd=1),
                sigma.prior = list(spec="unif",min=0, 
					max=max(data$values, na.rm = TRUE)),
                omega.prior = list(spec="unif",min=1, 
					max=10*max(data$values, na.rm = TRUE)),
                 Cstar.prior = list(spec="unif",min=0, 
					max=max(data$values, na.rm = TRUE)))
Arguments
| param | Parameter set. It has to be a named vector, with names: 
 | 
| river | A  | 
| covariates | Data frame containing covariate values for all  | 
| Z.normalize | Logical. Should covariates be Z-normalized? | 
| no.det | Logical. Should a probability of non-detection be included in the model? | 
| ll.type | Character. String defining the error distribution used in the log-likelihood formulation. 
Allowed values are  | 
| data | eDNA data. Data frame containing columns  | 
| source.area | Defines the extent of the source area of a node. Possible values are  | 
| tau.prior,log_p0.prior,beta.prior,sigma.prior,omega.prior,Cstar.prior | Prior distribution for the relevant
parameters of the eDITH model. Only used if both  | 
Value
A list with objects:
| p | Vector of eDNA production rates corresponding to the parameter 
set  | 
| C | Vector of eDNA values (concentrations or read numbers) corresponding to the parameter set  | 
| probDet | Vector of detection probabilities corresponding to the parameter set  | 
| logprior | Value of the log-prior distribution (computed only if  | 
| loglik | Value of the log-likelihood distribution (computed only if  | 
| logpost | Value of the log-posterior distribution (computed only if  | 
See Also
See run_eDITH_BT, run_eDITH_optim for details on parameters names and log-likelihood specification.
Examples
library(rivnet)
data(wigger)
# calculate AEMs and use the first 10 as covariates
ae <- river_to_AEM(wigger)
covariates <- data.frame(ae$vectors[,1:10])
names(covariates) <- paste0("AEM",1:10) 
# covariates names must correspond to param names
set.seed(1); param <- c(3,-15, runif(10,-1,1))
names(param) <- c("tau", "log_p0", paste0("beta_AEM",1:10))
# param names must correspond to covariates names
out <- run_eDITH_single(param, wigger, covariates)
# add parameter sigma and compute detection probability
param <- c(param, 5e-12) 
names(param)[length(param)] <- "sigma"
# note that the value of sigma has to be within the range indicated by sigma.prior
out2 <- run_eDITH_single(param, wigger, covariates, ll.type="norm")
# include data and compute logprior, loglikelihood, logposterior
data(dataC)
out3 <- run_eDITH_single(param, wigger, covariates, 
		ll.type="norm", data=dataC)