0
$\begingroup$

I would like to generate one random numer $single\sim N(0,1)$ and create the vector that contains only this one number: $one = [single, single, ..., single]$ . Later, I would like to combine with vector of multiple random numbers $several \sim N(0,1)$ using $weight$:

$New=weight*one+\sqrt(1-weight^2)*several$

Is it $New\sim N(0,1)?$

I thought so, because both $one$, and $several$ are random and generated from normal distribution. However, right now, I am not so sure. $one$ is in fact a vector of the same values so it might be treateat as constant here.

I tried to use R code to check below:

results<-matrix(ncol=4,nrow<-0)

colnames(results)<-c("sd(Normal)", "mean(Normal)", "sd(New)", "mean(new)")

for(i in 1:100000){

  set.seed(i)
  one<-rnorm(1,mean=0,sd=1)
  several<-rnorm(4000, mean=0, sd=1)

  weight<-0.20

  NORMAL<-several #this is N(0,1)
  NEW<- weight*one+sqrt(1-weight^2)*several #not sure if N(0,1)

  vector<- c(sd(NORMAL), mean(NORMAL), sd(NEW), mean(NEW))
  results<- rbind(results, vector)
}

colMeans(results)*100 #BP
sqrt(1-weight^2)*100 #BP

Results:

      sd(Normal)   mean(Normal)      sd(New)       mean(new) 
      99.99548850  -0.00423462       97.97516937   0.04152757

The results sd(New) are very similar to the $sqrt(1-weight^2)*100=97.97959$ and that raised my question about $New$ variable.

$\endgroup$
4
  • 3
    $\begingroup$ Mathematically, your question doesn't make sense until you can explain what it means to add a scalar to a vector. Could you edit the post to clarify this point? $\endgroup$
    – whuber
    Commented Aug 9, 2019 at 12:04
  • $\begingroup$ Thanks for your comment: I have edited to make sure we are adding vectors. $\endgroup$
    – Lohengrin
    Commented Aug 9, 2019 at 12:44
  • $\begingroup$ In symbols, are you asking about the distribution of the vector $(Y_i)$ where $Y_i=a X + b Z_i$ with $a,b$ constants with $a^2+b^2=1,$ $X$ Normally distributed, $Z_i$ multinormally distributed independently of $X$? $\endgroup$
    – whuber
    Commented Aug 9, 2019 at 12:51
  • $\begingroup$ Yes, in R set.seed(1) we have: $X=[0.7083495, 0.7083495, 0.7083495, ...], Z_i = [-0.03846413, 0.94647475, 0.84385583, ... ]$ wheras $ Y_i = [0.1039829,1.0690220, 0.9684764]$ I am not sure if $Y_i ~N(0,1)$ $\endgroup$
    – Lohengrin
    Commented Aug 9, 2019 at 13:28

1 Answer 1

1
$\begingroup$

$New=weight*one+\sqrt(1-weight^2)*several$ change to $$Y_{ij}=wX_i +\sqrt{1-w^2}Z_{ij}$$ where $X,Z$ follows standard normal distribution and independent from each other, and $ 0\le w\le 1$.

Let $\gamma_i = wX_i$, then $\gamma_i \sim N(0,w^2)$. Let $\epsilon_{ij} = \sqrt{1-w^2}Z_{ij}$ then $\epsilon \sim N(0, 1-w^2)$. $$Y_{ij}=\gamma_i+\epsilon_{ij}$$ It is the random part in the mixed model. Let see the whole picture of $Y_{ij}$. Let $i=1,...,I$ and $j=1,..., J$. Let $Y = (Y_{11} ,Y_{12},...,Y_{1J},...,Y_{i1},...,Y_{IJ})'$ $$\begin{pmatrix} Y_{11}\\ Y_{12}\\ ...\\ Y_{1J} \end{pmatrix} = \begin{pmatrix} 1& 1 &0 &...&0\\ 1& 0& 1 &...&0\\ ...&...&...&...&...\\ 1&0&0&...&1 \end{pmatrix} \begin{pmatrix} \gamma_1\\ \epsilon_{11}\\ \epsilon_{12}\\ ...\\ \epsilon_{1J} \end{pmatrix}$$ $$Var\begin{pmatrix} \gamma_1\\ \epsilon_{11}\\ \epsilon_{12}\\ ...\\ \epsilon_{1J} \end{pmatrix} = \begin{pmatrix} w^2& 0 & ...&0\\ 0&1-w^2&...&0\\ ...&...&...&...\\ 0&0&...&1-w^2 \end{pmatrix}$$ Following $Var(AX)=AVar(X)A'$, you can get $$Var\begin{pmatrix} Y_{11}\\ Y_{12}\\ ...\\ Y_{1J} \end{pmatrix} = \begin{pmatrix} 1& 1 &0 &...&0\\ 1& 0& 1 &...&0\\ ...&...&...&...&...\\ 1&0&0&...&1 \end{pmatrix} \begin{pmatrix} w^2& 0 & ...&0\\ 0&1-w^2&...&0\\ ...&...&...&...\\ 0&0&...&1-w^2 \end{pmatrix}\begin{pmatrix} 1& 1 &0 &...&0\\ 1& 0& 1 &...&0\\ ...&...&...&...&...\\ 1&0&0&...&1 \end{pmatrix}=\begin{pmatrix} 1&w^2&...&w^2\\ w^2& 1&...&w^2\\ ...&...&...&...\\ w^2&w^2&...&1 \end{pmatrix}_{J\times J} =\Sigma$$

Then $Y\sim N(0, I\otimes \Sigma)$.

What you did is setting $I=1$ and $J=4000$. The sample variance of $Y_{1j}, j=1,...,4000$ is the estimate of conditional variance $Var(Y_{ij}|i=1) = Var(Y_{1j}|\gamma_1) = Var(\epsilon_{1j}) = 1-w^2$

If you want to verify the unconditional variance of $Y_{ij}$ being 1, you can set $I = 200$ and $J=20$. and re-run roue code.

$\endgroup$
3
  • $\begingroup$ Many thanks for your help - I see that you put a lot of effort into writing the answer. I just want to clarify this point: $\Sigma = \begin{pmatrix} 1&w^2&...&w^2\\ w^2& 1&...&w^2\\ ...&...&...&...\\ w^2&w^2&...&1 \end{pmatrix}_{I\times I}$ how did you get this one? $\endgroup$
    – Lohengrin
    Commented Aug 10, 2019 at 16:10
  • $\begingroup$ The details were added in the Answer. Need matrix skill. $\endgroup$
    – user158565
    Commented Aug 10, 2019 at 17:54
  • $\begingroup$ All is clear now, many many thanks user158565! $\endgroup$
    – Lohengrin
    Commented Aug 12, 2019 at 21:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.