Learn R Programming

exPrior (version 1.0.1)

genExPrior: prior using from external data

Description

genExPrior generates priors from a set of data from multiple sites

Usage

genExPrior(exdata, theta, niter = 10^5, range_alpha = NULL,
  seed = NULL, hierarchicalSigma = F, spatialCoordinates = F,
  verbose = F)

Arguments

exdata

a dataframe containing external data to assimilate, with fields val and site_id (see example)

theta

a vector of numerical values of informative prior evaluation points

niter

(optional) an integer for the number of samples to use in the MCMC

range_alpha

(optional) a vector of two values corresponding to the lower and the upper bounds of the uniform distribution for alpha

seed

(optional) a value for the seed to make calls of genExPrior deterministic

hierarchicalSigma

(optional) a boolean specifying whether the site-specific variance is defined hierarchically by an inverse-gamma distribution (T) or by a prior (F)

spatialCoordinates

(optional) a boolean specifying whether spatial coordinates are provided as covariates to numerical external data. If T, the spatial autocorrelation of external data is accounted for, assuming that the spatial covariance has an exponential form.

verbose

(optional) boolean indicating whether R should print information from the progress

Value

the pdf at values corresponding to theta

Examples

Run this code
# NOT RUN {
theta <- seq(from=-5,to=5,by=1)
exdata <- data.frame(val=c(c(2,3,4),c(2,1),c(6,7,2,3)),
                  site_id=c(rep("a",3),rep("b",2),rep("c",4)),
                  x = c(c(2,3,4),c(2,3),c(2,2,3,3)),
                  y = c(c(2,2,3),c(3,2),c(2,3,2,3)))
genExPrior(exdata=exdata,theta=theta)
# }

Run the code above in your browser using DataLab