posteriorMCMC {BMAmevt}  R Documentation 
Generates a posterior parameters sample, and computes the posterior mean and componentwise variance online.
posteriorMCMC( prior = function(type = c("r", "d"), n, par, Hpar, log, dimData) { NULL }, proposal = function(type = c("r", "d"), cur.par, prop.par, MCpar, log) { NULL }, likelihood = function(x, par, log, vectorial) { NULL }, Nsim, dat, Hpar, MCpar, Nbin = 0, par.start = NULL, show.progress = floor(seq(1, Nsim, length.out = 20)), seed = NULL, kind = "MersenneTwister", save = FALSE, class = NULL, name.save = NULL, save.directory = "~", name.dat = "", name.model = "" )
prior 
The prior distribution: of type 
proposal 
The proposal function: of type 
likelihood 
The likelihood function.
Should be of type 
Nsim 
Total number of iterations to perform. 
dat 
An angular data set, e.g. constructed by

Hpar 
A list containing Hyperparameters to be passed to

MCpar 
A list containing MC MC tuning parameters to be
passed to 
Nbin 
Length of the burnin period. 
par.start 
Starting point for the MC MC sampler. 
show.progress 
An vector of integers containing the times (iteration numbers) at which a message showing progression will be printed on the standard output. 
seed 
The seed to be set via

kind 
The kind of random numbers generator. Default to
"MersenneTwister". See 
save 
Logical. Should the result be saved ? 
class 
Optional character string: additional class attribute to be assigned to the result. A predefined class 
name.save 
A character string giving the name under which
the result is to be saved. If 
save.directory 
A character string giving the directory where the result is to be saved (without trailing slash). 
name.dat 
A character string naming the data set used for inference. Default to 
name.model 
A character string naming the model. Default to 
A list made of
stored.vals
: A (NsimNbin)*d
matrix, where
d
is the dimension of the parameter space.
llh
A vector of size (NsimNbin)
containing the loglikelihoods evaluated at each parameter of the posterior sample.
lprior
A vector of size (NsimNbin)
containing the logarithm of the prior densities evaluated at each parameter of the posterior sample.
elapsed
: The time elapsed, as given by
proc.time
between the start and the end of the run.
Nsim
: The same as the passed argument
Nbin
: idem.
n.accept
: The total number of accepted proposals.
n.accept.kept
: The number of accepted proposals after the burnin period.
emp.mean
The estimated posterior parameters mean
emp.sd
The empirical posterior sample standard deviation.
posteriorMCMC.pb
,
posteriorMCMC.pb
for specific uses
in the PB and the NL models.
data(Leeds) data(pb.Hpar) data(pb.MCpar) postsample1 < posteriorMCMC(Nsim=1e+3,Nbin=500, dat= Leeds, prior = prior.pb, proposal = proposal.pb, likelihood = dpairbeta, Hpar=pb.Hpar, MCpar=pb.MCpar) dim(postsample1[[1]]) postsample1[1] ## Not run: ## a more realistic one: postsample2 < posteriorMCMC(Nsim=50e+3,Nbin=15e+3, dat= Leeds, prior = prior.pb, proposal = proposal.pb, likelihood = dpairbeta, Hpar=pb.Hpar, MCpar=pb.MCpar) dim(postsample2[[1]]) postsample2[1] ## End(Not run)