I have a sample of a multivariate distribution, and I am interested in obtaining a sample from the marginals. I know the right way to do so is by simply taking the corresponding entries. What is the justification for this strategy? Is there a, probably simple, formula or result that justifies this procedure?
22100
I want to sample from a univariate density $f_X$ but I only know the relationship:  $$f_X(x) = \int f_{X\vert Y}(x\vert y)f_Y(y) dy.$$  I want to avoid the use of MCMC (directly on the integral representation) and, since $f_{X\vert Y}(x\vert y)$ and $f_Y(y)$ are easy to sample from, I was thinking of using the following sampler:   For $j=1,\dots, N$.  Sample $y_j \sim f_Y$. Sample $x_j \sim f_{X\vert Y}(\cdot\vert y_j)$.   Then, I will end up with the pairs $(x_1,y_1),...,(x_N,y_N)$, and take only the marginal samples $(x_1,\dots,x_N)$.  Is this correct?
7414
I have a problem where I have 5 examples of truncated bimodal distributions between different ranges of (-1.0, +1.0), (-0.18, +0.18), (-0.12, +0.12) and (-0.15, +0.15). The example distributions can be viewed .  Please note that for all of the given example bimodal distributions, there is no zero values within the given distribution! The data distributions have values ranging between the given ranges EXCEPT of ZERO!  I am trying to create a sampling technique which can create random samples by obeying the given bimodal samples in the examples. The samples to be drawn can be of any size/shape/dimension such as 784, 5000, etc.  Any ideas how I can create such truncated bimodal data distributions between intervals 'a' and 'b' or [a, b] (both points are included)!  Thanks!
40734
Suppose I have a random sample $\lbrace X_i, Y_i\rbrace_{i=1}^n$. Assume this sample is such that the Gauss-Markov assumptions are satisfied such that I can construct an OLS estimator where  $$\hat{\beta}_1^{OLS} = \frac{\text{Cov}(X,Y)}{\text{Var(X)}}$$ $$\hat{\beta}_0^{OLS} = \bar{Y} - \bar{X} \hat{\beta}_1^{OLS}$$  Now suppose I take my data set and double it, meaning there is an exact copy for each of the $n$ $(X_i,Y_i)$ pairs.  My Question  How does this affect my ability to use OLS? Is it still consistent and identified?
70944
I often find myself asking questions like, "I know this variable $x$  lies in $(0,1)$ and most of the mass lies in $(0,.20)$ and then declines continuously towards 1.  What distribution can I use to model it?"  In practice, I wind up using the same few distributions over and over again simply because I know them.  Instead, I'd like to look them up in a more systematic way.  How do I go about accessing the wealth of work that probabilitists have done developing all of these distributions?  Ideally I'd like a reference organized by properties (region of support, etc.), so I can find distributions by their characteristics and then learn more about each distribution based on the tractability of the pdf/cdf and how closely the theoretical derivation fits the problem I'm working on.  Does such a reference exist, and if not, how do you go about choosing distributions?
23613
I am currently trying to simulate values of a $N$-dimensional random variable $X$ that has a multivariate normal distribution with mean vector $\mu = (\mu_1,...,\mu_N)^T$ and covariance matrix $S$.  I am hoping to use a procedure similar to the inverse CDF method, meaning that I want to first generate a $N$-dimensional uniform random variable $U$ and then plug that into the inverse CDF of this distribution, so to generate value $X$.  I am having issues because the procedure is not well documented and there are slight differences between the  and a .  In my case, I am also choosing the parameters of the distribution randomly. In particular, I generate each of the means, $\mu_i$, from a uniform distribution $U(20,40)$. I then build the covariance matrix $S$ using the following procedure:   Create a lower triangular matrix $L$ where $L(i,i) = 1$ for $i=1..N$ and $L(i,j)  = U(-1,1)$ for  $i &lt; j$ Let $S = LL^T$ where $L^T$ denotes the transpose of $L$.   This procedure allows me to ensure that $S$ is symmetric and positive definite. It also provides a lower triangular matrix $L$ so that $S = LL^T$, which I believe is required to generate values from the distribution.  Using the guidelines on Wikipedia, I should be able to generate values of $X$ using a $N$-dimensional uniform as follows:   $X = \mu + L * \Phi^{-1}(U)$   According to the MATLAB function however, this is typically done as:   $X = \mu + L^T * \Phi^{-1}(U)$   Where $\Phi^{-1}$ is the inverse CDF of a $N$-dimensional, separable, normal distribution, and the only difference between both methods is simply whether to use $L$ or $L^T$.  Is MATLAB or Wikipedia the way to go? Or are both wrong?
88044
I am looking at part a) and I have found the marginal p.f for $Y$ to be $e^{-2}2^{y}/y!$. I have set up for the equation for the marginal p.f for $X$ but I have no idea how to start it. Help would be appreciated.
114943
Let $X_1, X_2, \ldots, X_{16}$ be  independent with $N(3,4)$ distributions and $\bar{X}$ denote the sample mean. Find:   $P(-8 &lt; 2 \bar{X} &lt; -4)$. A number $K$ such that $P(-K &lt; 2 \bar{X} &lt; K) = 0.99$. $P(-10 &lt; 3 X_1+X_7 &lt; -8)$. A number $K$ such that $P(3 X_2+X_5 &lt; K) = 0.3$.   If someone could give me some help or hints on where to start with (a) or any of the problems that would be really helpful and I'd really appreciate it.
7840
Let random vector $x = (x_1,...,x_n)$ follow multivariate normal distribution with mean $m$ and covariance matrix $S$. If $S$ is symmetric and positive definite (which is the usual case) then one can generate random samples from $x$ by first sampling indepently $r_1,...,r_n$ from standard normal and then using formula $m + Lr$, where $L$ is the Cholesky lower factor so that $S=LL^T$ and $r = (r_1,...,r_n)^T$.  What about if one wants samples from singular Gaussian i.e. $S$ is still symmetric but not more positive definite (only positive semi-definite). We can assume also that the variances (diagonal elements of $S$) are strictly positive. Then some elements of $x$ must have linear relationship and the distribution actually lies in lower dimensional space with dimension $&lt;n$, right?  It is obvious that if e.g. $n=2, m = \begin{bmatrix} 0 \\ 0 \end{bmatrix}, S = \begin{bmatrix} 1 &amp; 1 \\ 1 &amp; 1\end{bmatrix}$ then one can generate $x_1 \sim N(0,1)$ and set $x_2=x_1$ since they are fully correlated. However, is there any good methods for generating samples for general case $n&gt;2$? I guess one needs first to be able identify the lower dimensional subspace, then move to that space where one will have valid covariance matrix, then sample from it and finally deduce the values for the linearly dependent variables from this lower-dimensional sample. But what is the best way to that in practice? Can someone point me to books or articles that deal with the topic; I could not find one.
79192
Let's say I have a $p$-dimensional multivariate Gaussian distribution. And I take $n$ observations (each of them a $p$-vector) from this distribution and calculate the sample covariance matrix $S$. In this , the authors state that the sample covariance matrix calculated with $p &gt; n$ is singular.    How is it true or derived? Any explanations?
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$?
18927
I am self-studying Gibbs sampling from a book. The book introduces metropolis hastings algortihm to generate representative values from a posterior distribution. So we know $p(D | \theta) p(\theta)$ but not in the normalized form. So we generate those values.   Now when it introduces Gibbs sampling it quotes,      Gibbs sampling is especially useful when the   complete joint posterior, $p(θ_i |D)$, cannot be analytically determined   and cannot be directly sampled, but all the conditional distributions,   $ p(θ_i |\{θ_{j \ne i}\}, D)$, can be determined and directly sampled.   Suppose we have two parameters $\theta_1$ and $\theta_2$ so for determining $p(θ_1|θ_2, D)$, we need $\frac{p(θ_1, θ_2|D)}{p(θ_2|D)}$, and now I am all the more confused. First it says      when we can't analytically determine the posterior   and then uses  $\frac{p(θ_1, θ_2|D)}{p(θ_2|D)}$ , where we don't know yet the posterior distribution, because that is not "analytically determined". Can anyone explain, what am I understanding wrong.
75272
I have a cluster of p-dimensional points and given a new p-dimensional point $x$ I want to determine whether or not it is likely to belong to this cluster.   The cluster is made up of $n$ p-dimensional points, I am making the assumption that these points are drawn from a multivariate Gaussian distribution with sample mean ${\hat{\mu_X}}$ and sample covariance matrix $\hat{\sigma_X}$.  Given a new point $x$ I am trying to decide if it is likely to belong to this cluster using the following threshold on the : $$\frac{n}{(n-1)^2}\left(X_i-\hat{\mu}_X\right)'\hat{\sigma}_X^{-1}\left(X_i-\hat{\mu}_X\right)&gt;B_{0.95}\left(\frac{p}{2},\frac{n-p-1}{2}\right)$$  However, some clusters have very few sample points $n$ in which case calculating the inverse covariance matrix $\hat{\sigma_X}^{-1}$ becomes impossible.  Are there any other equivalent or more appropriate measure I can use in this case?
43263
How do I sample a random rotation matrix in $n$ dimensions? Let $M$ be a $n\times n$-dimensional matrix.  $M$ is a rotation matrix if $\|Mx\|_2 = \|x\|_2$ for all $x \in \mathbb{R}^n$.  I want to sample uniformly at random from the rotations, in the following sense.  Let $\mathcal{S}=\{x: \|x\|_2=1\}$ denote the perimeter of a sphere of radius $1.$  I want a distribution on $M$ so that, if you fix any point $x \in \mathcal{S}$, then $Mx$ will be uniformly distributed on $\mathcal{S}$. How can I sample a matrix $M$ from this distribution?  I am looking for an algorithmic procedure I can use to sample such a matrix randomly. I believe this corresponds to sampling uniformly at random from $O(n)$ (the ).  I am fine with either a procedure for sampling uniformly at random from $O(n)$ or $SO(n)$; it should be easy to convert between the two of them.
119537
I used to work with Monte-Carlo simulations for a while. In my case, I generated random data for a variety of input parameters according to uniform distributions (with non-negative support), say for example two variables $a$ and $b$ where data is generated: $a_1, \dots, a_n \leftarrow U(1,2)$ and $b_1, \dots, b_n \leftarrow U(4,5)$.   Eventually, I evaluated a deterministic model $M$ for all generated pairs $(a_i,b_i)$ and calculate some statistics, like sample average of $\frac{M(a_1,b_1) + \dots + M(a_n,b_n)}{n}$.  Here is my question: What is the purpose of drawing random samples from the uniform distribution, rather than deterministically select $n$ equally distributed point from the interval $[1,2]$ and $[4,5]$ respectively and simply evaluate $M$ with those points? So, what would be the purpose of doing this stochastically rather than deterministically?
69363
Provided a sample size "N" that I plan on using to forecast data. What are some of the ways to subdivide the data so that I use some of it to establish a model, and the remainder data to validate the model?  I know there is no black and white answer to this, but it would be interesting to know  some "rules of thumb" or usually used ratios. I know back at university, one of our professors used to say model on 60% and validate on 40%.
18712
How can I sample from a mixture distribution, and in particular a mixture of Normal distributions in R? For example, if I wanted to sample from:   $$ 0.3\!\times\mathcal{N}(0,1)\; + \;0.5\!\times\mathcal{N}(10,1)\; + \;0.2\!\times\mathcal{N}(3,.1) $$  how could I do that?
90606
$$ \begin{align}F(x,y) &amp;= P(X\leq x, Y\leq y) \\  &amp;= C(F(x), F(y)) \end{align}$$ The copula of a bivariate distribution is equal to its CDF, $C(u,v) = F(x,y)$. The density of the data's CDF therefore can be expressed as $$f(x,y) = c(u,v) \times f_X(x) f_Y(y)$$ where $c(u,v)$ is the copula density and $f_X(x)$ is a marginal. If $\hat{C}(u,v)$ is the survival copula for determining $$ \begin{align}\bar{F}(x,y) &amp;= P(X&gt; x, Y &gt; y) \\  &amp;= \hat{C}(1-F(x), 1-F(y)) \end{align}$$ how is the first equation of the ordinary copula, $C(u,v)$, linked to the survival copula as $$\hat{C}(u,v) = u + v - 1 + C(1-u,1-v)$$ are $u$ and $v$ merely vectors containing the (ranked) observations of the uniform marginals? A derivation in integrals and probabilities (rather than $F$s) would be good.