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

This function performs robust MCMC algorithms in a parallel way for generalized linear spatial models and generates posterior samples for latent variables and hyper-parameters.

1 2 3 4 5 6 7 | ```
runMCMC.multiChain(Y, L = 0, loc, X = NULL, run = 200, run.S = 1,
rho.family = "rhoPowerExp", Y.family = "Poisson",
priorSigma = "Halft", parSigma = c(1, 1), ifkappa = 0,
scales = c(0.5, 1.65^2 + 0.8, 0.8, 0.7, 0.15),
phi.bound = c(0.005, 1), initials = list(c(1), 1.5, 0.2, 1),
MCMCinput = NULL, partial = FALSE, famT = 1,
n.chn = 2, n.cores = getOption("cores"))
``` |

`Y` |
a vector of length n which indicates the response variables |

`L` |
a vector of length n; it 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 |

`loc` |
a |

`X` |
a |

`run` |
the number of iterations |

`run.S` |
the number of internal iterations for latern variables |

`rho.family` |
take the value of |

`Y.family` |
take the value of |

`priorSigma` |
the prior distribution for |

`parSigma` |
the parameters for the prior distribution of |

`ifkappa` |
take zero or non-zero value which indicates whether |

`scales` |
a vector which indicates the tuning parameters for |

`phi.bound` |
the upper and lower bound for |

`initials` |
a list which indicates the initial values for |

`MCMCinput` |
a list of alternative settings |

`partial` |
a logical input which indicats whether partial posterior sampling should be used; only works for Y.family = "Poisson" |

`famT` |
take the value of 1, 2, or 3 which indicates the type of partial posterior sampling: 1 means "mean" diagnostic statistic is used, 2 means "maximum", and 3 means "minimum"; ignored if partial=FALSE |

`n.chn` |
the number of Markov chain sets that will be generated in parallel |

`n.cores` |
the number of CPUs that will be used to generate parallel Markov chains |

Essentially, this function runs `runMCMC`

function simultaneously on different CPUs (if there are more than one CPU available) with different initial values. In the case the number of available CPUs is less than "n.chn", Markov chains will be put in a queue.

This function performs parallel computing with the help of `{multicore}`

package. Be aware that `{multicore}`

package currently is not available in Windows (so use `runMCMC.sf`

instead).

A list of length "n.chn" containing the result of each Markov chain. Each element is a list with elements:

`S.posterior` |
a |

`m.posterior` |
a |

`s.posterior` |
a vector with length "run" containing the posterior samples for |

`a.posterior` |
a vector with length "run" containing the posterior samples for |

`k.posterior` |
a vector with length "run" containing the posterior samples for |

`AccRate` |
a vector which indicates the acceptance rates |

Liang Jing [email protected]

`MCMCinput`

, `runMCMC`

, `runMCMC.sf`

.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | ```
## Not run:
require(multicore)
data(datWeed)
Y <- Weed[,3]
loc <- unifLoc(Weed[,1:2])
L <- rep(1, length(Y))
input.Weed <- MCMCinput( run=1000, run.S=10, rho.family="rhoPowerExp",
Y.family = "Poisson",
priorSigma = "Halft", parSigma = c(1, 1),
ifkappa=0,
scales=c(0.5, 3.5, 0.9, 0.6, 0.5),
phi.bound=c(0.005, 1),
initials=list(c(-1), 1, 0.1, 1) )
res.prl <- runMCMC.multiChain(Y, L=L, loc=loc, X=NULL,
MCMCinput = input.Weed, n.chn = 4, n.cores = 4)
## End(Not run)
``` |

geoCount documentation built on May 31, 2017, 3:49 a.m.

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.