hzar.chain.doSeq: Repeatedly run the optimizer in series to tune the optimizer.

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

Description

hzar.chain.doSeq cyclically calls hzar.doFit and hzar.next.fitRequest in order to optimize the covariance matrix driving mcmc process, MCMCmetrop1R.

Usage

1
2
3
4
hzar.chain.doSeq(hzar.request,
                 count = 3,
                 collapse = FALSE,
                 announce.complete = "Chain Complete")

Arguments

hzar.request

The hzar.fitRequest object to use initially.

count

How many iterations to perform.

collapse

If TRUE, if all iterations succeed return a single hzar.fitRequest object with all of the results concatenated instead of a list of hzar.fitRequest objects.

announce.complete

Diagnostics message to print when the chain has completed.

Details

For each iteration, hzar.doFit is called using hzar.request and the result is added to the results list.

For the second and all subsequent iterations, hzar.request is generated by hzar.next.fitRequest using the results of the previous iteration. If hzar.next.fitRequest fails, the results list is returned.

When count iterations are performed and if collapse is TRUE, the results list is reduced to a single hzar.fitRequest object with the covariance matrix set to the last matrix used. All other fields are set as if the concatenated results were the results of a single call to hzar.doFit.

Value

Either a list of all successful hzar.fitRequest objects, or, if collapse is TRUE, a single hzar.fitRequest object with all of the results concatenated.

Author(s)

Graham Derryberry asterion@alum.mit.edu

See Also

hzar.fitRequest hzar.doFit MCMCmetrop1R hzar.next.fitRequest

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
data(manakinMolecular);
mknAdaA <-
  hzar.doMolecularData1DPops(manakinMolecular$distance,
                             manakinMolecular$ada.A,
                             manakinMolecular$ada.nSamples);
mknAdaAmodel <-
  hzar.makeCline1DFreq(mknAdaA, scaling="fixed",tails="none");
mknAdaAmodel <-
  hzar.model.addBoxReq(mknAdaAmodel, -30, 600)
mknAdaAmodelFit <-
  hzar.first.fitRequest.old.ML(model=mknAdaAmodel ,
                               mknAdaA,
                               verbose=FALSE);
mknAdaAmodelFit$mcmcParam$chainLength <- 1e3;
mknAdaAmodelFit$mcmcParam$burnin <- 50;
mknAdaAmodelFit$mcmcParam$thin <- 10;
str(hzar.chain.doSeq(mknAdaAmodelFit, count=2));

hzar documentation built on May 2, 2019, 7 a.m.