úÎ!KÁ@­ź      !"#$%&'()*+,-./01 2 3 4 5 6 7 8 9 : ; < = > ? @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z [ \ ] ^ _ ` a b c d efghijklmnopqrstuvwxyz{|}~€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ Ą˘Ł¤ĽŚ§¨ŠŞŤŹ­ŽŻ°ą˛ł´ľśˇ¸šşťByteString tools(c) Dominik Schrempf, 2020GPL-3.0-or-laterdominik.schrempf@gmail.comunstableportableSafeÝmcmcnFor a given width, align string to the right; use given fill character; trim on the left if string is longer.mcmcTFor a given width, align string to the right; trim on the left if string is longer.mcmcnFor a given width, align string to the left; use given fill character; trim on the right if string is longer.mcmcTFor a given width, align string to the left; trim on the right if string is longer.Links of Markov chains(c) Dominik Schrempf 2020GPL-3.0-or-laterdominik.schrempf@gmail.comunstableportableNonećmcmcAn , or link of the Markov chain. For reasons of computational efficiency, each state is associated with the corresponding prior and likelihood.mcmc%The current state in the state space a.mcmcThe current prior. mcmcThe current likelihood.  Monitor logarithmic values(c) Dominik Schrempf, 2020GPL-3.0-or-laterdominik.schrempf@gmail.comunstableportableNoneemcmcPrint a log value.Monitor parameters(c) Dominik Schrempf, 2020GPL-3.0-or-laterdominik.schrempf@gmail.comunstableportableNoneSX(¤mcmc)Instruction about a parameter to monitor.GConvert a parameter monitor from one data type to another with '(>$<)'.For example, monitor a ź( value being the first entry of a tuple: mon = fst >$< monitorDouble mcmcName of parameter.mcmc>Instruction about how to extract the parameter from the state.mcmc:Convert a parameter monitor from one data type to another. DEPRECATED.For example, to monitor a ź( value being the first entry of a tuple: mon = fst @. monitorDouble mcmcMonitor ˝.mcmcMonitor ź, with eight decimal places (half precision).mcmcMonitor źb with full precision computing the shortest string of digits that correctly represent the number.mcmcMonitor ź* in exponential format and half precision.mcmcName.mcmcName.mcmcName.mcmcName.  Monitor parameters(c) Dominik Schrempf, 2020GPL-3.0-or-laterdominik.schrempf@gmail.comunstableportableNoneSX?~mcmcëInstruction about a parameter to monitor via batch means. Usually, the monitored parameter is average over the batch size. However, arbitrary functions performing more complicated analyses on the states in the batch can be provided.CConvert a batch monitor from one data type to another with '(>$<)'.BFor example, batch monitor the mean of the first entry of a tuple: mon = fst >$< monitorBatchMean ‚XXX: Batch monitors are slow at the moment because the monitored parameter has to be extracted from the state for each iteration.mcmc"Name of batch monitored parameter.mcmc?Instruction about how to extract the batch mean from the trace.mcmc@Convert a batch parameter monitor from one data type to another.EFor example, to batch monitor the mean of the first entry of a tuple: mon = fst @# monitorBatchMean mcmcIBatch monitor. Print the mean with eight decimal places (half precision).!mcmcBatch monitor. Print the mean with full precision computing the shortest string of digits that correctly represent the number."mcmc,Batch monitor real float parameters such as ź4 with scientific notation and eight decimal places.#mcmc6Batch monitor parameters with custom lens and builder. mcmcName.!mcmcName."mcmcName.#mcmcName.mcmc%Function to calculate the batch mean.mcmcCustom builder.  !"#  !"#Print time related values(c) Dominik Schrempf, 2020GPL-3.0-or-laterdominik.schrempf@gmail.comunstableportableSafeDĂ%mcmc;Adapted from System.ProgressBar.renderDuration of package  ?https://hackage.haskell.org/package/terminal-progress-bar-0.4.1terminal-progressbar-0.4.1.&mcmcRender duration in seconds.%&%&'Convenience functions to compute priors(c) Dominik Schrempf, 2020GPL-3.0-or-laterdominik.schrempf@gmail.comunstableportableNoneO¨'mcmc&Improper uniform prior; larger than 0.(mcmc%Improper uniform prior; lower than 0.)mcmcUniform prior on [a, b].*mcmcNormal distributed prior.+mcmcExponential distributed prior.,mcmcGamma distributed prior.-mcmc8Intelligent product that stops when encountering a zero.’Use with care because the elements are checked for positiveness, and this can take some time if the list is long and does not contain any zeroes.)mcmcLower bound a.mcmcUpper bound b.*mcmcMean.mcmcStandard deviation.+mcmcRate.,mcmcShape.mcmcScale.'()*+,-'()*+,-Shuffle a list(c) Dominik Schrempf 2020GPL-3.0-or-laterdominik.schrempf@gmail.comunstableportableNoneTĽ.mcmcShuffle a list./mcmcShuffle a list n times.0mcmcgrabble xs m n is O(m*n'), where n' = min n (length xs) . Choose n' elements from xs , without replacement, and that m times../0./0 Proposals and cycles(c) Dominik Schrempf 2020GPL-3.0-or-laterdominik.schrempf@gmail.comunstableportableNoneSX’}1mcmc For each key k6, store the number of accepted and rejected proposals.3mcmc In brief, a 3 is a list of proposals.<The state of the Markov chain will be logged only after all > s in the 3b have been completed, and the iteration counter will be increased by one. The order in which the > s are executed is specified by 5. The default is 6. Proposals must have unique names!, so that they can be identified.5mcmcDefine the order in which >s are executed in a 3. The total number of >s per 3 may differ between 5s (e.g., compare 6 and 8).6mcmc Shuffle the > s in the 3. The >Ps are replicated according to their weights and executed in random order. If a > has weight w, it is executed exactly w times per iteration.7mcmcThe >>s are executed sequentially, in the order they appear in the 3. >s with weight w>1 are repeated immediately w2 times (and not appended to the end of the list).8mcmc Similar to 65. However, a reversed copy of the list of shuffled >`s is appended such that the resulting Markov chain is reversible. Note: the total number of >.s executed per cycle is twice the number of 6.9mcmc Similar to 7@. However, a reversed copy of the list of sequentially ordered >Bs is appended such that the resulting Markov chain is reversible.:mcmcTune the acceptance ratio of a >; see F, or K.=mcmc+Simple proposal without tuning information.jInstruction about randomly moving from the current state to a new state, given some source of randomness.ţIn order to calculate the Metropolis-Hastings ratio, we need to know the ratio of the backward to forward kernels (i.e., the probability masses or probability densities). For unbiased proposals, this ratio is 1.0. For biased proposals, the ratio is ?.>mcmcA >M is an instruction about how the Markov chain will traverse the state space ar. Essentially, it is a probability mass or probability density conditioned on the current state (i.e., a kernel).A >| may be tuneable in that it contains information about how to enlarge or shrink the step size to tune the acceptance ratio.@mcmc7Name (no proposals with the same name are allowed in a 3).Amcmc"The weight determines how often a >0 is executed per iteration of the Markov chain.Bmcmc=Simple proposal without name, weight, and tuning information.CmcmcTuning is disabled if set to ž.Dmcmc>Convert a proposal from one data type to another using a lens. For example: %scaleFirstEntryOfTuple = _1 @~ scale Emcmc$Create a possibly tuneable proposal.FmcmcTune a > . Return ž if >& is not tuneable. If the parameter dt is larger than 1.0, the > is enlarged, if 0<dt<1.0>, it is shrunk. Negative tuning parameters are not allowed.Gmcmc Create a 3 from a list of >s.HmcmcSet the order of >s in a 3.Imcmc Replicate >7s according to their weights and possibly shuffle them.JmcmcTune > s in the 3. See F.Kmcmc.Calculate acceptance ratios and auto tune the > s in the 3. For now, a >[ is enlarged when the acceptance ratio is above 0.44, and shrunk otherwise. Do not change >s that are not tuneable.LmcmcSummarize the > s in the 3 . Also report acceptance ratios.Mmcmc$In the beginning there was the Word.8Initialize an empty storage of accepted/rejected values.NmcmcFor key k:, prepend an accepted (True) or rejected (False) proposal.OmcmcReset acceptance storage.PmcmcXTransform keys using the given lists. Keys not provided will not be present in the new 1 variable.żmcmc4Acceptance counts and ratio for a specific proposal.Qmcmc$Acceptance ratios for all proposals.EmcmcťFunction creating a simple proposal for a given tuning parameter. The larger the tuning parameter, the larger the proposal (and the lower the expected acceptance ratio), and vice versa.mcmcName.mcmcWeight.mcmcActivate tuning?!123456789:;<=>?@ABCDEFGHIJKLMNOPQ!>?@ABCD=:;<EF5678934GHIJKL12MNOPQ %Generic interface to create proposals(c) Dominik Schrempf 2020GPL-3.0-or-laterdominik.schrempf@gmail.comunstableportableNoneäZmcmc@Generic function to create proposals for continuous parameters (ź).[mcmc>Generic function to create proposals for discrete parameters (˝).ZmcmcProbability distributionmcmc0Forward operator, e.g. (+), so that x + dx = x'.mcmcInverse operator, e.g., ŔD, so that x' + (negate dx) = x. Only required for biased proposals.[mcmcProbability distribution.mcmc0Forward operator, e.g. (+), so that x + dx = x'.mcmcInverse operator, e.g., ŔD, so that x' + (negate dx) = x. Only required for biased proposals.Z[Z[ Normally distributed proposal(c) Dominik Schrempf 2020GPL-3.0-or-laterdominik.schrempf@gmail.comunstableportableNoneSXŻ\mcmc3Additive proposal with normally distributed kernel.]mcmcĘAdditive proposal with normally distributed kernel with mean zero. This proposal is very fast, because the Metropolis-Hastings ratio does not include calculation of the forwards and backwards kernels.^mcmcźAdditive proposal with uniformly distributed kernel. This proposal is very fast, because the Metropolis-Hastings ratio does not include calculation of the forwards and backwards kernels._mcmc3Additive proposal with normally distributed kernel.ƒThe two values are slid contrarily so that their sum stays constant. Contrary proposals are useful when parameters are confounded.\mcmcMean.mcmcStandard deviation.mcmcName.mcmcWeight.mcmcEnable tuning.]mcmcStandard deviation.mcmcName.mcmcWeight.mcmcEnable tuning.^mcmcDelta.mcmcName.mcmcWeight.mcmcEnable tuning._mcmcMean.mcmcStandard deviation.mcmcName.mcmcWeight.mcmcEnable tuning.\]^_\]^_ (Scaling proposal with Gamma distribution(c) Dominik Schrempf 2020GPL-3.0-or-laterdominik.schrempf@gmail.comunstableportableNoneSXť›`mcmc6Multiplicative proposal with Gamma distributed kernel.amcmc6Multiplicative proposal with Gamma distributed kernel.pThe scale of the Gamma distributions is set to (shape)^{-1}, so that the mean of the Gamma distribution is 1.0.bmcmc6Multiplicative proposal with Gamma distributed kernel.‰The two values are scaled contrarily so that their product stays constant. Contrary proposals are useful when parameters are confounded.`mcmcShape.mcmcScale.mcmcName.mcmcWeight.mcmcEnable tuning.amcmcShape.mcmcName.mcmcWeight.mcmcEnable tuning.bmcmcShape.mcmcScale.mcmcName.mcmcWeight.mcmcEnable tuning.`ab`ab Bactrian proposals(c) Dominik Schrempf, 2020GPL-3.0-or-laterdominik.schrempf@gmail.comunstableportableNoneÉÚcmcmcWAdditive symmetric proposal with kernel similar to the silhouette of a Bactrian camel.The  Ahttps://www.ncbi.nlm.nih.gov/pmc/articles/PMC3845170/figure/fig01Bactrian kernelů is a mixture of two symmetrically arranged normal distributions. The spike parameter loosely determines the standard deviations of the individual humps while the second parameter refers to the standard deviation of the complete Bactrian kernel.See  5https://www.ncbi.nlm.nih.gov/pmc/articles/PMC3845170/.dmcmcXMultiplicative proposal with kernel similar to the silhouette of a Bactrian camel. See c.cmcmcSpike parameter.mcmcStandard deviation.mcmcName.mcmcWeight.mcmcEnable tuning.dmcmcSpike parameter.mcmcStandard deviation.mcmcName.mcmcWeight.mcmcEnable tuning.cdcdTrace of a Markov chain(c) Dominik Schrempf 2020GPL-3.0-or-laterdominik.schrempf@gmail.comunstableportableNoneрemcmcA eO passes through a list of states with associated likelihoods which are called s. New Os are prepended, and the path of the Markov chain is stored in reversed order.fmcmcThe empty trace.gmcmc Prepend an  to a e.hmcmc&Get the most recent item of the trace.imcmc)Get the N most recent items of the trace.jmcmc"Shorten the trace to given length.efghijefghijBe quiet! Or better not?(c) Dominik Schrempf, 2020GPL-3.0-or-laterdominik.schrempf@gmail.comunstableportableNoneÖrmcmcNot much to say here.zmcmcPerform action if r is t or higher.{mcmcPerform action if r is u or higher.|mcmcPerform action if r is v.rvustz{|rvustz{|Monitor a Markov chain(c) Dominik Schrempf, 2020GPL-3.0-or-laterdominik.schrempf@gmail.comunstableportableNoneđ&mcmcYMonitor to a file, but calculate batch means for the given batch size; constructed with ‰.}Batch monitors are slow at the moment because the monitored parameter has to be extracted from the state for each iteration.€mcmc$Monitor to a file; constructed with ˆ.mcmc-Monitor to standard output; constructed with ‡.‚mcmcA ‚™ describes which part of the Markov chain should be logged and where. Further, they allow output of summary statistics per iteration in a flexible way.„mcmc#Monitor writing to standard output.…mcmcMonitors writing to files.†mcmc7Monitors calculating batch means and writing to files.‡mcmcMonitor to standard output.ˆmcmcMonitor parameters to a file.‰mcmc"Monitor parameters to a file, see .Šmcmc#Open the files associated with the ‚.‹mcmc#Open the files associated with the ‚ in append mode.ŒmcmcsExecute monitors; print status information to files and return text to be printed to standard output and log file.mcmc$Close the files associated with the ‚.‡mcmc+Instructions about which parameters to log.mcmcLogging period.ˆmcmc$Name; used as part of the file name.mcmc+Instructions about which parameters to log.mcmcLogging period.‰mcmc$Name; used as part of the file name.mcmcQInstructions about which parameters to log and how to calculate the batch means.mcmc Batch size.Œmcmc Verbositymcmc Iteration.mcmcStarting state.mcmcStarting time.mcmcTrace of Markov chain.mcmc-Total number of iterations; to calculate ETA.mcmc The monitor.€‚ƒ„…†‡ˆ‰Š‹Œ‚ƒ„…†‡€ˆ‰Š‹ŒWhat is an MCMC?(c) Dominik Schrempf 2020GPL-3.0-or-laterdominik.schrempf@gmail.comunstableportableNoneÓŽmcmcThe ŽV contains all information to run an MCMC chain. It is constructed using the function ˘.The polymorphic type aT stores the state of the chain. It can also be used to store auxiliary information.mcmc0The name of the MCMC chain; used as file prefix.‘mcmc The current E of the chain combines the current state and the current likelihood.’mcmc0The iteration is the number of completed cycles.“mcmcThe e8 of the Markov chain in reverse order, the most recent  is at the head of the list.”mcmc For each >Š, store the list of accepted (True) and rejected (False) proposals; for reasons of efficiency, the list is also stored in reverse order.•mcmc6Number of burn in iterations; deactivate burn in with ž.–mcmcGAuto tuning period (only during burn in); deactivate auto tuning with ž.—mcmcbNumber of normal iterations excluding burn in. Note that auto tuning only happens during burn in.˜mcmc#Overwrite output files? Default is Á, change with ¤.™mcmcVSave the chain with trace of given length at the end of the run? Default is no save (ž). Change with Ł.šmcmc Verbosity.›mcmcThe random number generator.œmcmcSStarting time and starting iteration of chain; used to calculate run time and ETA.mcmcHandle to log file.žmcmc`The prior function. The un-normalized posterior is the product of the prior and the likelihood.ŸmcmceThe likelihood function. The un-normalized posterior is the product of the prior and the likelihood. mcmc A set of > s form a 3.ĄmcmcA ‚ observing the chain.˘mcmcInitialize the Ž# of a Markov chain Monte Carlo run.Łmcmc1Save the Markov chain with trace of given length.¤mcmc5Overwrite existing files; it is not necessary to use ¤, when a chain is continued.ĽmcmczDo not print anything to standard output. Do not create log file. File monitors and batch monitors are executed normally.Śmcmc Be verbose.˘ mcmc.Name of the Markov chain; used as file prefix.mcmcThe prior function.mcmcThe likelihood function.mcmc A list of >Hs executed in forward order. The chain will be logged after each cycle.mcmcA ‚ observing the chain.mcmc%The initial state in the state space a.mcmc6Number of burn in iterations; deactivate burn in with ž.mcmcGAuto tuning period (only during burn in); deactivate auto tuning with ž.mcmcbNumber of normal iterations excluding burn in. Note that auto tuning only happens during burn in. mcmcfA source of randomness. For reproducible runs, make sure to use generators with the same, fixed seed.Ž“ ™‘œ’”•–—˜š›žŸĄ˘Ł¤ĽŚŽ“ ™‘œ’”•–—˜š›žŸĄ˘Ł¤ĽŚ Save the state of a Markov chain(c) Dominik Schrempf, 2020GPL-3.0-or-laterdominik.schrempf@gmail.comunstableportableNone"v§mcmcSave a Ž to file.JSome important values have to be provided upon restoring the status. See ¨.¨mcmcLoad a Ž from file.ŸImportant information that cannot be saved and has to be provided again when a chain is restored: - prior function - likelihood function - cycle - monitor(To avoid incomplete continued runs, the .mcmc file is removed after load.§¨§¨ Mcmc helpers(c) Dominik Schrempf, 2020GPL-3.0-or-laterdominik.schrempf@gmail.comunstableportableNone.ąŤmcmc‰An Mcmc state transformer; usually fiddling around with this type is not required, but it is used by the different inference algorithms.Źmcmc&Write to standard output and log file.­mcmc&Write to standard output and log file.ŽmcmcPrint warning message.ŻmcmcPrint warning message.°mcmcPrint info message.ąmcmcPrint info message.˛mcmcPrint debug message.łmcmcPrint debug message.´mcmcAuto tune the > s in the 3- of the chain. Reset acceptance counts. See K.ľmcmcReset acceptance counts.śmcmcPrint short summary of >s in 3. See L.ˇmcmc Report what is going to be done.¸mcmc Execute the ‚s of the chain. See Œ.šmcmcRun an MCMC algorithm.ŤŹ­ŽŻ°ą˛ł´ľśˇ¸šŤŹ­ŽŻ°ą˛ł´ľśˇ¸šMetropolis-Hastings at its best(c) Dominik Schrempf 2020GPL-3.0-or-laterdominik.schrempf@gmail.comunstableportableNoneĘ= !"#'()*+,-356789>DGH\]^_`abcd€‚ƒ‡ˆ‰˘Ł¤ĽŚ¨şť#>D`abd\]^_c3G56789H˘Ł¤ĽŚ‚ƒ‡€ˆ‰ťş¨Safe@ˆÂĂÄĹĆÇČÉĘ !"#$%&'())*+,-./01223456789:;<=>?@ABCDEF G H I J K L M N O P Q R S T T U V W X Y Z [ \ ] ^ _ ` a b c d e f g h i j k l m n o p q r s t u v w x yz{|}~€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–——˜™š›œžŸ Ą˘˘Ł¤ĽŚ§¨ŠŞŤŹ­ŽŻ°ą˛ł´ľśˇ¸‘šşťź˝žżŔÁÂĂÄĹĆÇČÉĘËĚÍÎĎÍÎĐŃŇ ÓÔŐÍÎÖ×ŘŮÚŰÜÝŢß!mcmc-0.2.4-8nnYEbLbJzuEoGYzDRpE9uMcmc.Monitor.ParameterMcmc.Internal.ByteString Mcmc.ItemMcmc.Monitor.LogMcmc.Monitor.ParameterBatchMcmc.Monitor.Time Mcmc.PriorMcmc.Tools.Shuffle Mcmc.ProposalMcmc.Proposal.GenericMcmc.Proposal.SlideMcmc.Proposal.ScaleMcmc.Proposal.Bactrian Mcmc.TraceMcmc.Verbosity Mcmc.Monitor Mcmc.Status Mcmc.Save Mcmc.McmcMcmc.MetropolisMcmc Paths_mcmcbaseData.Functor.Contravariant>$<alignRightWith alignRight alignLeftWith alignLeftItemstateprior likelihood$fFromJSONItem $fToJSONItem$fEqItem $fOrdItem $fShowItem $fReadItem renderLogMonitorParametermpNamempFunc@. monitorInt monitorDoublemonitorDoubleFmonitorDoubleE$fContravariantMonitorParameterMonitorParameterBatchmbpNamembpFunc@#monitorBatchMeanmonitorBatchMeanFmonitorBatchMeanEmonitorBatchCustom$$fContravariantMonitorParameterBatchrenderDurationrenderDurationSpositivenegativeuniformnormal exponentialgammaproduct'shuffleshuffleNgrabble AcceptancefromAcceptanceCycle ccProposalsOrderRandomO SequentialORandomReversibleOSequentialReversibleOTunertParamtFuncProposalSimpleProposalpNamepWeightpSimplepTuner@~createProposaltunefromListsetOrdergetNIterations tuneCycle autotuneCyclesummarizeCycleemptyApushAresetAtransformKeysAacceptanceRatios $fOrdProposal $fEqProposal$fShowProposal$fDefaultOrder$fFromJSONAcceptance$fToJSONAcceptance $fEqOrder $fShowOrdergenericContinuousgenericDiscreteslideslideSymmetric slideUniformslideContrarilyscale scaleUnbiasedscaleContrarily slideBactrian scaleBactrianTrace singletonTpushTheadT takeItemstakeT$fFromJSONTrace $fToJSONTrace $fMonoidTrace$fSemigroupTrace $fShowTrace $fReadTrace $fEqTrace VerbosityQuietWarnInfoDebug$fShowVerbosity $fEqVerbosity$fOrdVerbositywarninfodebug$fFromJSONVerbosity$fToJSONVerbosity MonitorBatch MonitorFile MonitorStdOutMonitormStdOutmFilesmBatches monitorStdOut monitorFile monitorBatchmOpenmAppendmExecmCloseStatusnameitem iterationtrace acceptanceburnInIterationsautoTuningPeriod iterationsforceOverwritesave verbosity generatorstart logHandlepriorF likelihoodFcyclemonitorstatussaveWithforcequiet saveStatus loadStatus$fFromJSONSave $fToJSONSavemcmcOutTmcmcOutS mcmcWarnT mcmcWarnS mcmcInfoT mcmcInfoS mcmcDebugT mcmcDebugS mcmcAutotune mcmcResetAmcmcSummarizeCycle mcmcReportmcmcMonitorExecmcmcRun mhContinuemhghc-prim GHC.TypesDoubleInt GHC.MaybeNothingacceptanceRatioGHC.NumnegateFalseversion getBinDir getLibDir getDynLibDir getDataDir getLibexecDir getSysconfDirgetDataFileName