predY: Predict for Unsampled Locations

Description Usage Arguments Details Value Author(s) See Also Examples

Description

This function generates posterior predictive samples of latent and response variables for predicting locations.

Usage

1
2
3
4
predY(res.m, loc, locp, X = NULL, Xp = NULL, Lp = 0, k = 1, 
      rho.family = "rhoPowerExp", Y.family = "Poisson", 
      parallel = NULL, n.cores = getOption("cores"), 
      cluster.type = "SOCK")

Arguments

res.m

a list with elements containing the posterior samples of latent variables and parameters for observed locations

loc

a matrix which indicates the coordinates of the observed locations

locp

a matrix which indicates the coordinates of the predicting locations

X

the covariate matrix for observed locations

Xp

the covariate matrix for predicting locations

Lp

a vector which indicates the time duration during which the Poisson counts are accumulated or the total number of trials for Binomial response; if 0 is found in the vector, 1 will be used to replace all the values in the vector

k

a value for fixed κ; ignored if there are posterior samples for κ in "res.m"

rho.family

take the value of "rhoPowerExp" or "rhoMatern" which indicates the powered exponential or Matern correlation function is used

Y.family

take the value of "Poisson" or "Binomial" which indicates Poisson or Binomial distribution for response variables

parallel

the default input NULL indicates no parallel computing will be applied; any input value indicates parallel computing with the help of {snowfall}

n.cores

the number of CPUs that will be used for parallel computing; used only if parallel isn't NULL

cluster.type

type of cluster to be used for parallel computing; can be "SOCK", "MPI", "PVM", or "NWS"; used only if parallel="snowfall"

Details

This function performs parallel computing with the help of {snowfall} package.

Value

A list with elements:

latent.predict

a matrix containing the posterior predictive samples for latent variables

Y.predict

a matrix containing the posterior predictive samples for response variables

Author(s)

Liang Jing ljing918@gmail.com

See Also

runMCMC.

Examples

1
2
3
4
5
6
7
8
9
## Not run: 
Ypred <- predY(res.m, loc, locp, X=loc, Xp=locp, k=1, 
               rho.family = "rhoPowerExp", Y.family = "Poisson")
# require(snowfall)
# Ypred <- predY(res.m, loc, locp, X=loc, Xp=locp, 
#                parallel="snowfall", n.cores = 4)
Ypred.avg <- rowMeans(Ypred$Y); EYpred.avg <- rowMeans(exp(Ypred$latent))

## End(Not run)

geoCount documentation built on May 2, 2019, 12:38 a.m.

Related to predY in geoCount...