I have to randomly generate 1000 points over a unit disk such that are uniformly distributed on this disk. Now, for that, I select a radius $r$ and angular orientation $\alpha$ such that the radius $r$ is a uniformly distributed variate from $r \in [0,1]$ while $\alpha$ is a uniformly distributed variate from $\alpha \in [0, 2\pi]$ using the following code r &lt;- runif(1000, min=0, max=1)  alpha &lt;- runif(1000, min=0, max=2*pi) x &lt;- r*cos(alpha) y &lt;- r*sin(alpha) plot(x,y, pch=19, col=rgb(0,0,0,0.05), asp=1)  Then I look at my sample space and it looks like this:  This obviously doesn't look like a sample with uniform distribution over the disk. Hence, I guessed that the problem might be occurring as a result of a lack of independence between the variables $r$ and $\alpha$ in contingency to how they've been linked computationally. To take care of that I wrote a new code. rm(list=ls()) r &lt;- runif(32, min=0, max=1) df_res &lt;- data.frame(matrix(c(-Inf, Inf), byrow = T, nrow = 1)) for (i in 1:32) {   for (j in 1:32) {     alpha &lt;- runif(32, min=0, max=2*pi)     r &lt;- runif(32, min=0, max=1)     df &lt;- data.frame(matrix(c(r[i],alpha[j]), byrow = T, nrow = 1))     df_res &lt;- rbind(df_res,df)   } } df_res &lt;- subset(df_res, df_res$X1 != -Inf) x&lt;- df_res$X1 *cos(df_res$X2) y &lt;- df_res$X1 *sin(df_res$X2) plot(x,y, pch=19, col=rgb(0,0,0,0.05), asp=1)  And, yet again the sample looks non-uniformly distributed over the disk  I'm starting to suspect that there is a deeper mathematical problem going on in the vicinity. Could someone help me write code that would create a sample space uniformly distributed over the disk, or explain the mathematical fallacy if any in my reasoning?
78060
I was attempting to simulate injection of random points within a circle, such that any part of the circle has the same probability of having a defect.  I expected the count per area of the resulting distribution to follow a Poisson distribution if I break up the circle into equal area rectangles.    Since it requires only placing points within a circular area, I injected two uniform random distributions in polar coordinates: $R$ (radius) and $\theta$ (polar angle).  But after doing this injection, I clearly get more points in the center of the circle compared to the edge.     What would be the correct way to perform this injection across the circle such that the points are randomly distributed across the cirlce?
30662
It is known that given $X=(X_1, X_2, \ldots, X_n)$ iid $\sim N(0,1)$, then $X/\sqrt{X_1^2+\cdots+X_n^2}$ is uniformly distributed on the surface of unit sphere.  Intuitively, I know that that's because the probability of $X/\sqrt{X_1^2+\cdots+X_n^2}$ belonging to any region with the same area on the surface should be the same. But how can I prove it mathematically?
36151
It's a standard result that given $X_1,\cdots ,X_n $ random sample from $N(\mu,\sigma^2)$, the random variable $$\frac{(n-1)S^2}{\sigma^2}$$ has a chi-square distribution with $(n-1)$ degrees of freedom, where $$S^2=\frac{1}{n-1}\sum^{n}_{i=1}(X_i-\bar{X})^2.$$ I would like help in proving the above result. Thanks.
118458
Suppose we have  $$X_1 \sim \textrm{unif}(n,0,1),$$ $$X_2 \sim \textrm{unif}(n,0,1),$$  where $\textrm{unif}(n,0,1)$ is uniform random sample of size n, and   $$Y=X_1,$$  $$Z = 0.4 X_1 + \sqrt{1 - 0.4}X_2.$$  Then the correlation between $Y$ and $Z$ is $0.4$.  How can I extend this to three variables: $X_1$, $X_2$, $X_3$?
14410
How to find the Cumulative Distribution Function (CDF) and Probability Distribution Function (PDF) for uniform variable inside circle given by $R^2 = (X-c_1)^2+(Y-c_2)^2$, where ($c_1, c_2$) is the center of circle.  I think that the PDF for problem is given by  \begin{equation} f(x,y) = \begin{cases} \frac{1}{\pi R^2}&amp;, \quad (x-c_1)^2 + (y-c_2)^2 \leq R^2\\ 0&amp;, \quad otherwise \end{cases} \end{equation}
8299
I was reading Robert Serfling's 1980 book "Approximation Theorems of Mathematical Statistics" and came across the following construction of the Dvoretzky–Kiefer–Wolfowitz inequality for arbitrary distributions $F$,  which DKW prove for distributions on $[0,1]$.     Given independent $X_i$ with d.f. F and defined on a common probability space, one can construct independent uniform $[0,1]$ variates $Y_i$ such that $\mathbf{P}[X_i = F^{-1}(Y_i)] =1,\forall i$.   Why? Is this true for arbitrary distributions (including discontinuous ones)?  Secondly,     Let $G$ denote the uniform $[0,1]$ distribution and $G_n$ the sample distribution function of the $Y_i$s. Then $F(x)=G(F(x))$ and with probability $1$, $F_n(x) = G_n(F(x))$.   Why?  Now I don't understand quantile functions as well I would like, and so am having some trouble following these arguments.   Edit: All of this is on page 59 of the book.    whuber, thank you so much for your careful answer. It is appreciated. The answer to my question does indeed lie in the last paragraph of your reply - now if I could only wrap my head around it.  What is throwing me off is the following example which I have recreated from Galen Shorack's "Probability for Statisticians" (page 111). Here, the Lebesgue measure of the set $[X\neq F^{-1}Y]$ is not zero. Would you agree? I am referring to the points in the interval $(2,3)$ and in $(3,3.5)$ for which the inverse transformation does not bring any points back. Thank you again for looking into this.   \documentclass[a4paper]{article} % Graphics \usepackage{graphics} \usepackage{graphicx} \usepackage{pstricks} \usepackage{pst-plot} \usepackage{pstricks-add} \usepackage{epstopdf} \begin{document}  % An arbitrary CDF \begin{figure}[htbp] \begin{center} \begin{psgraph}[arrows=&lt;-&gt;](0,0)(-1.5,-.3)(6,1.2){.5\textwidth}{2.5cm}  \psplot[algebraic, linecolor=black]{-1}{1}{.025*x^2+.1*x+.175} % {this goes from .1 --&gt; .3}  \psplot[algebraic, linecolor=black]{1}{2}{-.1*x^2+.4*x+.1}  % {this goes form .4 --&gt; .5}  \psline[linecolor=black](2,.5)(3,.5)  % this stays at .5  \psline[linecolor=black](3,.6)(3.5,.6)  % this stays at .6  \psplot[algebraic, linecolor=black]{3.5}{5}{  -0.1333*(x-5)^2+.9}  % this goes from .6 --&gt; .9  \psdots[dotstyle=*](3,.6)(1,0.4)   \end{psgraph} \end{center} \caption{Arbitrary CDF with discontinuities and flat sections} \label{fig:cdf} \end{figure}  % The quantile function \begin{figure}[htbp] \begin{center} \begin{psgraph}[arrows=&lt;-&gt;](0,0)(-.3, -1.5)(1.2, 6){2cm}{5cm} % inverses using the Matlab finverse symbolic toolbox function \psplot[algebraic, linecolor=black]{.1}{.3}{20*(x/10 - 3/400)^(1/2) - 2}  \psline[linecolor=black](.3, 1)(.4, 1)   \psplot[algebraic, linecolor=black]{.4}{.5}{-((x-0.5)/(-0.1))^(0.5)+2}   \psline[linecolor=black](.5, 3)(.6, 3) \psplot[algebraic, linecolor=black]{.6}{.9}{-((x-.9)/(-0.1333))^(0.5)+5} \psdots[dotstyle=*](.6, 3)(.5, 2) \end{psgraph} \end{center} \caption{Quantile function of CDF in figure (\protect \ref{fig:cdf})} \label{fig:qf} \end{figure} \end{document}   PS. I could not use the comment box for the reply as I needed to use the &lt;code> environment.
64551
We have a bivariate normal process where $X, Y \sim N(0, \sigma)$, with no covariance.  (For convenience we can assert that $\sigma = 1$, or that we have a good estimate for its value.)  What is the distribution of the random variable $R(n) =  \sqrt{\overline{x_i}^2 + \overline{y_i}^2}$ &mdash; i.e., the Euclidean distance between the sample center of a n points and the true center (at the origin)?  Note that as defined:   $R(n) \ge 0$ $E[R(n)] \to 0$ monotonically as $n \to \infty$ The Rayleigh distribution gives us $R(1) = \sigma \sqrt{\pi/2} \approx \sigma 1.25$   Furthermore, based on a Monte Carlo simulation for $n \in [2, 25]$ with $\sigma = 1$:   Variance decreases monotonically as n increases Skewness appears constant across n at 0.63 Kurtosis appears constant across n at about 0.24   (This question is a simplified version of  that seems to have gotten derailed in complications.)
18879
Let $U_1, \cdots, U_n$ be $n$ i.i.d continuous uniform random variables on $(0,1)$ and their order statistics be $U_{(1)}, \cdots, U_{(n)}$.  Define $D_i=U_{(i)}−U_{(i−1)}$ for $i=1, \cdots, n$ with $U_0=0$.  I am trying to figure out the distribution $\lim_{n\to\infty} \#\{i = 1, \cdots, n \mid nD_i \geq z\}/n$. This must be very well known, but I cannot find a reference.
115613
Take a random sample $X_1, X_2,\ldots X_n$ from the distribution $f(x;\theta)=1/\theta$ for $0\le x\le  \theta$.  I need to show that $Y=\max(X_1,X_2,...,X_n)$ is complete.  Now, I know I should multiply the sample distribution of $Y$ and multiply it with a function of $Y$, then integrate over the range of $\theta$ and equate them to zero. But how do I get the sampling distribution of $Y$?
66529
If I have two variables $X$ and $Y$ which randomly take on values uniformly from the range $[a,b]$ (all values equally probable), what is the expected value for $\max(X,Y)$?
90539
Apparently, the solution to the  is that a uniform probability distribution over the positive real numbers doesn't exist. Can anyone explain why this is the case and what probability distributions can exist over the positive real numbers (it seems that this would be quite limited, given that such a simple distribution is impossible)?
26874
I'm trying to come up with a metric for measuring non-uniformity of a distribution for an experiment I'm running.  I have a random variable that should be uniformly distributed in most cases, and I'd like to be able to identify (and possibly measure the degree of) examples of data sets where the variable is not uniformly distributed within some margin.    An example of three data series each with 10 measurements representing frequency of the occurrence of something I'm measuring might be something like this:  a: [10% 11% 10%  9%  9% 11% 10% 10% 12%  8%] b: [10% 10% 10%  8% 10% 10%  9%  9% 12%  8%] c: [ 3%  2% 60%  2%  3%  7%  6%  5%  5%  7%]   &lt;-- non-uniform d: [98% 97% 99% 98% 98% 96% 99% 96% 99% 98%]   I'd like to be able to distinguish distributions like c from those like a and b, and measure c's deviation from a uniform distribution.  Equivalently, if there's a metric for how uniform a distribution is (std. deviation close to zero?), I can perhaps use that to distinguish ones with high variance.  However, my data may just have one or two outliers, like the c example above, and am not sure if that will be easily detectable that way.   I can hack something to do this in software, but am looking for statistical methods/approaches to justify this formally.  I took a class years ago, but stats is not my area.  This seems like something that should have a well-known approach.  Sorry if any of this is completely bone-headed.  Thanks in advance!
43115
Suppose that  $X$ and $Y$ are two i.i.d. uniform random variables on the interval $[0,1]$  Let $Z=X/Y$, I am finding the cdf of $Z$, i.e. $ \Pr(Z\leq z) $.  Now, I came up with two ways of doing this. One produces a correct answer consistent with the pdf here: , the other does not. Why is the second method wrong?  First Method  $\newcommand{\rd}{\mathrm{d}} \Pr(Z\leq z) = \Pr(X/Y\leq z) = \Pr(X\leq zY) = \int^{1}_{0}\int^{\min(1,zy)}_{0} \rd x \rd y = \int^{1}_{0}\min(1,zy)\ \rd y$ $  = \left\{      \begin{array}{lr}        \int^{1/z}_{0}zy\ \rd y + \int^{1}_{1/z} \rd y&amp; : z &gt; 1\\        \int^{1}_{0}zy\ \rd y &amp; : z \leq 1      \end{array}    \right. $ $  = \left\{      \begin{array}{lr}        1 - \frac{1}{2z} &amp; : z &gt; 1\\        \frac{z}{2} &amp; : z \leq 1      \end{array}    \right. $  This appears correct.  Second Method  $\Pr(X/Y\leq z) = \Pr(X \leq zY\ |\ zY \geq 1)\Pr(zY \geq 1) + \Pr(X \leq zY\ |\ zY &lt; 1)\Pr(zY &lt; 1) $ by total probability  $ = \Pr(X \leq zY\ |\ zY \geq 1)\Pr(Y \geq 1/z) + \Pr(X \leq zY\ |\ zY &lt; 1)\Pr(Y &lt; 1/z)$  Taking $z&gt;1$ yields $ (1)(1-\frac{1}{z}) + (\int^{1/z}_{0}\int^{zy}_{0} \rd x \rd y)(\frac{1}{z}) = 1-\frac{1}{z} + (\int^{1/z}_{0}zy\ \rd y)(\frac{1}{z}) = 1-\frac{1}{z} + \frac{1}{2z^{2}}$  This is already different. Why is this wrong?  Thanks!
12085
The following is a homework question for which I am asking guidance.     Let $A$, $B$, $C$ be independent random variables uniformly distributed between $(0,1)$. What is the probability that the polynomial $Ax^2 + Bx + C$ has real roots?   That means I need $P(B^2 -4AC \geq 0$). I've tried calling $X=B^2 -4AC$ and finding $1-F_X(0)$, where $F$ is the cumulative distribution function.  I have two problems with this approach. First, I'm having trouble determining the product of two uniform random variables. We haven't been taught anything like this in class, and couldn't find anything like it on Sheldon Ross' Introduction to Probability Models.  Second, this strategy just seems wrong, because it involves so many steps and subjects we haven't seen in class. Even if I calculate the product of $A$ and $C$, I'll still have to square $B$, multiply $AC$ by four and then subtract those results. It's too much for a homework question. I'm hoping there might be an easier way.
53341
Let $X_1, X_2, \dots$ be i.i.d. exponentially distributed RVs. For $n = 1,2,\dots$ consider: $Y_n := \max(X_1, X_2, \dots, X_n)$ $U_n := \sum_{i=1}^{n}\frac{X_i}{i}$ Show that $Y_n$ and $U_n$ have the same distribution   What I've tried: $P(Y_n&lt;y)= P(X_i&lt;y)^n = (1- e^{\lambda y})^n =&gt; P(Y_n=y) = n(1- e^{\lambda y})^{n-1}$ But I get stuck with $U_n$. I tried an MGF, $U_n$ evaluates nicely but then $Y_n$ gets messy. Any thoughts?
89011
I have posted a , this is related but I think it is better to start another thread. This time, I am wondering how to generate uniformly distributed points inside the 3-d unit sphere and how to check the distribution visually and statistically too? I don't see the strategies posted there directly transferable to this situation.
98634
How do I generate $n$ identically distributed but not independent normal random numbers such that their sum falls within a prespecified interval $[a,b]$ with probability $p$?  (This question is motivated by generating a random walk that ends up at a prespecified point: . Since a continuous random variable has zero probability of reaching an exact number, we do the second best thing and ask for an entire interval to end up in.)    EDIT:  has been proposed as a duplicate, which in turn is closed as a duplicate of . I agree that both of these are helpful. However, the point of the current question (more specifically, of the answer) is to first figure out that we can use a multivariate normal distribution to address the question, and second, what kind of covariance matrix works. How to sample from a distribution with that covariance is a third step, where the linked threads are helpful.