predY {geoCount} | R Documentation |
This function generates posterior predictive samples of latent and response variables for predicting locations.
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")
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 |
Y.family |
take the value of |
parallel |
the default input |
n.cores |
the number of CPUs that will be used for parallel computing; used only if |
cluster.type |
type of cluster to be used for parallel computing; can be "SOCK", "MPI", "PVM", or "NWS"; used only if |
This function performs parallel computing with the help of {snowfall}
package.
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 |
Liang Jing ljing918@gmail.com
## 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)