Skip to main content
added 910 characters in body
Source Link
user158565
  • 7.6k
  • 2
  • 12
  • 20

$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)$, where $\Sigma = \begin{pmatrix} 1&w^2&...&w^2\\ w^2& 1&...&w^2\\ ...&...&...&...\\ w^2&w^2&...&1 \end{pmatrix}_{I\times I}$.

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.

$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})'$

Then $Y\sim N(0, I\otimes \Sigma)$, where $\Sigma = \begin{pmatrix} 1&w^2&...&w^2\\ w^2& 1&...&w^2\\ ...&...&...&...\\ w^2&w^2&...&1 \end{pmatrix}_{I\times I}$

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.

$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.

Source Link
user158565
  • 7.6k
  • 2
  • 12
  • 20

$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})'$

Then $Y\sim N(0, I\otimes \Sigma)$, where $\Sigma = \begin{pmatrix} 1&w^2&...&w^2\\ w^2& 1&...&w^2\\ ...&...&...&...\\ w^2&w^2&...&1 \end{pmatrix}_{I\times I}$

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.