Posted on Categories:Operations Research, 数学代写, 运筹学

# 数学代写|运筹学代写Operations Research代考|MATH2730 The Metropolis-Hastings Algorithm

avatest™

## avatest™帮您通过考试

avatest™的各个学科专家已帮了学生顺利通过达上千场考试。我们保证您快速准时完成各时长和类型的考试，包括in class、take home、online、proctor。写手整理各样的资源来或按照您学校的资料教您，创造模拟试题，提供所有的问题例子，以保证您在真实考试中取得的通过率是85%以上。如果您有即将到来的每周、季考、期中或期末考试，我们都能帮助您！

•最快12小时交付

•200+ 英语母语导师

•70分以下全额退款

## 数学代写|运筹学代写Operations Research代考|The Metropolis-Hastings Algorithm

The Metropolis-Hastings algorithm is an example of a Markov chain Monte Carlo method. The algorithm will be explained for the case of a discrete probability distribution, but the basic idea of the algorithm can directly be generalized to the case of a continuous probability distribution.

Let us explain how the method can be used to attack the following basic problem arising amongst others in Bayesian inference. How to calculate $\sum_{s \in S} h(s) \pi(s)$, where $h(s)$ is a given function and the probability mass function $\pi(s)$ on the very large but finite set $S \subset I$ is known up to a multiplicative constant that cannot be computed directly? The idea is to construct a Markov chain that has $\pi(s)$ as its unique equilibrium distribution and to simulate a sequence $s_1, s_2, \ldots, s_m$ of successive states of this Markov chain for large $m$. Then $\sum_{s \in S} h(s) \pi(s)$ can be estimated by $\frac{1}{m} \sum_{k=1}^m h\left(s_k\right)$, by the ergodic Theorem 7.5 .

The algorithm uses candidate-transition functions $\bar{p}(t \mid s)$ for $s \in S$. $^7$ This function is to be interpreted as saying that when the current state is $s$ the candidate for the next state is $t$ with probability $\bar{p}(t \mid s)$. Thus you first choose, for each $s \in S$, a probability mass function ${\bar{p}(t \mid s), t \in S}$. These functions must be chosen in such a way that the Markov matrix with the $\bar{p}(t \mid s)$ as one-step transition probabilities is irreducible. The idea is to next adjust these transition probabilities in such a way that the corresponding Markov chain has ${\pi(s), s \in S}$ as its unique equilibrium distribution. The detailed balance equations (8.11) are the key to this idea. If the candidate-transition functions $\bar{p}(t \mid s)$ already satisfy the detailed balance equations
$$\pi(s) \bar{p}(t \mid s)=\pi(t) \bar{p}(s \mid t) \quad \text { for all } s, t \in S$$

## 数学代写|运筹学代写Operations Research代考|The Gibbs Sampler

The Gibbs sampler is a special case of Metropolis-Hastings sampling and is used to simulate from a multivariate density whose univariate conditional densities are fully known. This sampler is frequently used in Bayesian statistics. To introduce the method, consider the random vector $\left(X_1, \ldots, X_d\right)$ with the multivariate density function
$$\pi\left(x_1, \ldots, x_d\right)=\mathbb{P}\left(X_1=x_1, \ldots, X_d=x_d\right)$$
The univariate conditional densities of $\left(X_1, \ldots, X_d\right)$ are denoted by
\begin{aligned} & \pi_k\left(x \mid x_1, \ldots, x_{k-1}, x_{k+1}, \ldots, x_d\right) \ & =\mathbb{P}\left(X_k=x \mid X_1=x_1, \ldots, X_{k-1}=x_{k-1}, X_{k+1}=x_{k+1}, \ldots, X_d=x_d\right) \end{aligned}

## 数学代写|运筹学代写Operations Research代考|The Metropolis-Hastings Algorithm

Metropolis-Hastings 算法是马尔可夫链蒙特卡罗方法的一个例子。该算法将针对离散概率分布的 情况进行解释，但该算法的基本思想可以直接推广到连续概率分布的情况。

$$\pi(s) \bar{p}(t \mid s)=\pi(t) \bar{p}(s \mid t) \quad \text { for all } s, t \in S$$

## 数学代写|运筹学代写Operations Research代考|The Gibbs Sampler

Gibbs 采样器是 Metropolis-Hastings 采样的特例，用于从单变量条件密度完全已知的多变量密度 进行模拟。该采样器经常用于贝叶斯统计。为了介绍该方法，考虑随机向量 $\left(X_1, \ldots, X_d\right)$ 与多元密 度函数
$$\pi\left(x_1, \ldots, x_d\right)=\mathbb{P}\left(X_1=x_1, \ldots, X_d=x_d\right)$$

$$\pi_k\left(x \mid x_1, \ldots, x_{k-1}, x_{k+1}, \ldots, x_d\right) \quad=\mathbb{P}\left(X_k=x \mid X_1=x_1, \ldots, X_{k-1}=x_{k-1}, X_{k+1}=x_{k+1}, \ldots, X_d=x_d\right)$$

## MATLAB代写

MATLAB 是一种用于技术计算的高性能语言。它将计算、可视化和编程集成在一个易于使用的环境中，其中问题和解决方案以熟悉的数学符号表示。典型用途包括：数学和计算算法开发建模、仿真和原型制作数据分析、探索和可视化科学和工程图形应用程序开发，包括图形用户界面构建MATLAB 是一个交互式系统，其基本数据元素是一个不需要维度的数组。这使您可以解决许多技术计算问题，尤其是那些具有矩阵和向量公式的问题，而只需用 C 或 Fortran 等标量非交互式语言编写程序所需的时间的一小部分。MATLAB 名称代表矩阵实验室。MATLAB 最初的编写目的是提供对由 LINPACK 和 EISPACK 项目开发的矩阵软件的轻松访问，这两个项目共同代表了矩阵计算软件的最新技术。MATLAB 经过多年的发展，得到了许多用户的投入。在大学环境中，它是数学、工程和科学入门和高级课程的标准教学工具。在工业领域，MATLAB 是高效研究、开发和分析的首选工具。MATLAB 具有一系列称为工具箱的特定于应用程序的解决方案。对于大多数 MATLAB 用户来说非常重要，工具箱允许您学习应用专业技术。工具箱是 MATLAB 函数（M 文件）的综合集合，可扩展 MATLAB 环境以解决特定类别的问题。可用工具箱的领域包括信号处理、控制系统、神经网络、模糊逻辑、小波、仿真等。