# 数学代写|模拟和蒙特卡洛方法作业代写simulation and monte carlo method代考|MATH577

#### Doug I. Jones

Lorem ipsum dolor sit amet, cons the all tetur adiscing elit

couryes-lab™ 为您的留学生涯保驾护航 在代写模拟和蒙特卡洛方法simulation and monte carlo method方面已经树立了自己的口碑, 保证靠谱, 高质且原创的统计Statistics代写服务。我们的专家在代写模拟和蒙特卡洛方法simulation and monte carlo method代写方面经验极为丰富，各种代写模拟和蒙特卡洛方法simulation and monte carlo method相关的作业也就用不着说。

• Statistical Inference 统计推断
• Statistical Computing 统计计算
• (Generalized) Linear Models 广义线性模型
• Statistical Machine Learning 统计机器学习
• Longitudinal Data Analysis 纵向数据分析
• Foundations of Data Science 数据科学基础
couryes™为您提供可以保分的包课服务

## 数学代写|模拟和蒙特卡洛方法作业代写simulation and monte carlo method代考|Generating Continuous Random Variables

2.4.1.1 Exponential Distribution We start by applying the inverse-transform method to the exponential distribution. If $X \sim \operatorname{Exp}(\lambda)$, then its cdf $F$ is given by
$$F(x)=1-\mathrm{e}^{-\lambda x}, \quad x \geqslant 0 .$$
Hence, solving $u=F(x)$ in terms of $x$ gives
$$F^{-1}(u)=-\frac{1}{\lambda} \ln (1-u) .$$
Because $U \sim \mathrm{U}(0,1)$ implies $1-U \sim \mathrm{U}(0,1)$, we arrive at the following algorithm:

There are many alternative procedures for generating variables from the exponential distribution. The interested reader is referred to [2].

2.4.1.2 Normal (Gaussian) Distribution If $X \sim \mathrm{N}\left(\mu, \sigma^2\right)$, its pdf is given by
$$f(x)=\frac{1}{\sigma \sqrt{2 \pi}} \exp \left{-\frac{(x-\mu)^2}{2 \sigma^2}\right}, \quad-\infty<x<\infty,$$
where $\mu$ is the mean (or expectation) and $\sigma^2$ the variance of the distribution.
Since inversion of the normal cdf is numerically inefficient, the inverse-transform method is not very suitable for generating normal random variables, so other procedures must be devised. We consider only generation from $\mathrm{N}(0,1)$ (standard normal variables), since any random $Z \sim \mathrm{N}\left(\mu, \sigma^2\right)$ can be represented as $Z=\mu+\sigma X$, where $X$ is from $\mathrm{N}(0,1)$. One of the earliest methods for generating variables from $\mathrm{N}(0,1)$ was developed by Box and Muller as follows:

Let $X$ and $Y$ be two independent standard normal random variables; so $(X, Y)$ is a random point in the plane. Let $(R, \Theta)$ be the corresponding polar coordinates. The joint pdf $f_{R, \Theta}$ of $R$ and $\Theta$ is given by
$$f_{R, \Theta}(r, \theta)=\frac{1}{2 \pi} \mathrm{e}^{-r^2 / 2} r \quad \text { for } r \geqslant 0 \text { and } \theta \in[0,2 \pi) .$$
This can be seen by writing $x$ and $y$ in terms of $r$ and $\theta$, to get
$$x=r \cos \theta \quad \text { and } \quad y=r \sin \theta .$$
The Jacobian of this coordinate transformation is
$$\operatorname{det}\left(\begin{array}{ll} \frac{\partial x}{\partial r} & \frac{\partial x}{\partial \theta} \ \frac{\partial y}{\partial r} & \frac{\partial y}{\partial \theta} \end{array}\right)=\left|\begin{array}{cc} \cos \theta & -r \sin \theta \ \sin \theta & r \cos \theta \end{array}\right|=r .$$

## 数学代写|模拟和蒙特卡洛方法作业代写simulation and monte carlo method代考|Generating Discrete Random Variables

Since the execution time of Algorithm 2.4.8 is proportional to $n$, we may be motivated to use alternative methods for large $n$. For example, we could consider the normal distribution as an approximation to the binomial. In particular, by the central limit theorem, as $n$ increases, the distribution of $X$ is close to that of $Y \sim \mathrm{N}(n p, n p(1-p))$; see (1.26). In fact, the cdf of $\mathrm{N}(n p-1 / 2, n p(1-p))$ approximates the cdf of $X$ even better. This is called the continuity correction.
Thus, to obtain a binomial random variable, we could generate $Y$ from $\mathrm{N}(n p-$ $1 / 2, n p(1-p))$ and truncate to the nearest nonnegative integer. Equivalently, we could generate $Z \sim \mathrm{N}(0,1)$ and set
$$\max \left{0,\left\lfloor n p+\frac{1}{2}+Z \sqrt{n p(1-p)}\right]\right}$$
as an approximate sample from the $\operatorname{Bin}(n, p)$ distribution. Here $\lfloor\alpha\rfloor$ denotes the integer part of $\alpha$. One should consider using the normal approximation for $n p>10$ with $p \geqslant \frac{1}{2}$, and for $n(1-p)>10$ with $p<\frac{1}{2}$. 2.4.2.3 Geometric Distribution If $X \sim \mathrm{G}(p)$, then its pdf is of the form $$f(x)=p(1-p)^{x-1}, \quad x=1,2 \ldots .$$ The random variable $X$ can be interpreted as the number of trials required until the first success occurs in a series of independent Bernoulli trials with success parameter p. Note that $\mathbb{P}(X>m)=(1-p)^m$.

We now present an algorithm based on the relationship between the exponential and geometric distributions. Let $Y \sim \operatorname{Exp}(\lambda)$, with $\lambda$ such that $1-p=\mathrm{e}^{-\lambda}$. Then $X=\lfloor Y\rfloor+1$ has a $\mathrm{G}(p)$ distribution. This is because
$$\mathbb{P}(X>x)=\mathbb{P}(\lfloor Y\rfloor>x-1)=\mathbb{P}(Y \geqslant x)=\mathrm{e}^{-\lambda x}=(1-p)^x .$$
Hence, to generate a random variable from $\mathrm{G}(p)$, we first generate a random variable from the exponential distribution with $\lambda=-\ln (1-p)$, truncate the obtained value to the nearest integer, and add 1 .

# 模拟和蒙特卡洛方法代写

## 数学代写|模拟和蒙特卡洛方法作业代写模拟和蒙特卡罗方法代考|生成连续随机变量

$$F(x)=1-\mathrm{e}^{-\lambda x}, \quad x \geqslant 0 .$$

$$F^{-1}(u)=-\frac{1}{\lambda} \ln (1-u) .$$

$$f(x)=\frac{1}{\sigma \sqrt{2 \pi}} \exp \left{-\frac{(x-\mu)^2}{2 \sigma^2}\right}, \quad-\infty<x<\infty,$$

$$f_{R, \Theta}(r, \theta)=\frac{1}{2 \pi} \mathrm{e}^{-r^2 / 2} r \quad \text { for } r \geqslant 0 \text { and } \theta \in[0,2 \pi) .$$

$$x=r \cos \theta \quad \text { and } \quad y=r \sin \theta .$$这个坐标变换的雅可比矩阵是
$$\operatorname{det}\left(\begin{array}{ll} \frac{\partial x}{\partial r} & \frac{\partial x}{\partial \theta} \ \frac{\partial y}{\partial r} & \frac{\partial y}{\partial \theta} \end{array}\right)=\left|\begin{array}{cc} \cos \theta & -r \sin \theta \ \sin \theta & r \cos \theta \end{array}\right|=r .$$

## 数学代写|模拟和蒙特卡洛方法作业代写模拟和蒙特卡罗方法代考|生成离散随机变量

$$\max \left{0,\left\lfloor n p+\frac{1}{2}+Z \sqrt{n p(1-p)}\right]\right}$$

$$\mathbb{P}(X>x)=\mathbb{P}(\lfloor Y\rfloor>x-1)=\mathbb{P}(Y \geqslant x)=\mathrm{e}^{-\lambda x}=(1-p)^x .$$

## 有限元方法代写

tatistics-lab作为专业的留学生服务机构，多年来已为美国、英国、加拿大、澳洲等留学热门地的学生提供专业的学术服务，包括但不限于Essay代写，Assignment代写，Dissertation代写，Report代写，小组作业代写，Proposal代写，Paper代写，Presentation代写，计算机作业代写，论文修改和润色，网课代做，exam代考等等。写作范围涵盖高中，本科，研究生等海外留学全阶段，辐射金融，经济学，会计学，审计学，管理学等全球99%专业科目。写作团队既有专业英语母语作者，也有海外名校硕博留学生，每位写作老师都拥有过硬的语言能力，专业的学科背景和学术写作经验。我们承诺100%原创，100%专业，100%准时，100%满意。

## MATLAB代写

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

Days
Hours
Minutes
Seconds

# 15% OFF

## On All Tickets

Don’t hesitate and buy tickets today – All tickets are at a special price until 15.08.2021. Hope to see you there :)