The hardware and bandwidth for this mirror is donated by METANET, the Webhosting and Full Service-Cloud Provider.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]metanet.ch.
library(Ryacas0)
library(Matrix)
Consider this model: \[ x_i = a x_0 + e_i, \quad i=1, \dots, 4 \] and \(x_0=e_0\). All terms \(e_0, \dots, e_3\) are independent and \(N(0,1)\) distributed. Let \(e=(e_0, \dots, e_3)\) and \(x=(x_0, \dots x_3)\). Isolating error terms gives that \[ e = L_1 x \] where \(L_1\) has the form
<- diag(4)
L1chr 2:4, 1] <- "-a"
L1chr[<- as.Sym(L1chr)
L1 L1
## Yacas matrix:
## [,1] [,2] [,3] [,4]
## [1,] 1 0 0 0
## [2,] -a 1 0 0
## [3,] -a 0 1 0
## [4,] -a 0 0 1
If error terms have variance \(1\) then \(\mathbf{Var}(e)=L \mathbf{Var}(x) L'\) so the covariance matrix is \(V1=\mathbf{Var}(x) = L^- (L^-)'\) while the concentration matrix (the inverse covariances matrix) is \(K=L' L\).
<- Simplify(Inverse(L1))
L1inv <- Simplify(Transpose(L1) * L1)
K1 <- Simplify(L1inv * Transpose(L1inv)) V1
cat(
"\\begin{align}
K_1 &= ", TeXForm(K1), " \\\\
V_1 &= ", TeXForm(V1), "
\\end{align}", sep = "")
\[\begin{align} K_1 &= \left( \begin{array}{cccc} 3 a ^{2} + 1 & - a & - a & - a \\ - a & 1 & 0 & 0 \\ - a & 0 & 1 & 0 \\ - a & 0 & 0 & 1 \end{array} \right) \\ V_1 &= \left( \begin{array}{cccc} 1 & a & a & a \\ a & a ^{2} + 1 & a ^{2} & a ^{2} \\ a & a ^{2} & a ^{2} + 1 & a ^{2} \\ a & a ^{2} & a ^{2} & a ^{2} + 1 \end{array} \right) \end{align}\]
Slightly more elaborate:
<- diag(4)
L2chr 2:4, 1] <- c("-a1", "-a2", "-a3")
L2chr[<- as.Sym(L2chr)
L2 L2
## Yacas matrix:
## [,1] [,2] [,3] [,4]
## [1,] 1 0 0 0
## [2,] -a1 1 0 0
## [3,] -a2 0 1 0
## [4,] -a3 0 0 1
<- diag(4)
Vechr cbind(1:4, 1:4)] <- c("w1", "w2", "w2", "w2")
Vechr[<- as.Sym(Vechr)
Ve Ve
## Yacas matrix:
## [,1] [,2] [,3] [,4]
## [1,] w1 0 0 0
## [2,] 0 w2 0 0
## [3,] 0 0 w2 0
## [4,] 0 0 0 w2
<- Simplify(Inverse(L2))
L2inv <- Simplify(Transpose(L2) * Inverse(Ve) * L2)
K2 <- Simplify(L2inv * Ve * Transpose(L2inv)) V2
cat(
"\\begin{align}
K_2 &= ", TeXForm(K2), " \\\\
V_2 &= ", TeXForm(V2), "
\\end{align}", sep = "")
\[\begin{align} K_2 &= \left( \begin{array}{cccc} \frac{w_{1} a_{1} ^{2} w_{2} ^{2} + w_{1} w_{2} ^{2} a_{2} ^{2} + w_{1} w_{2} ^{2} a_{3} ^{2} + w_{2} ^{3}}{w_{1} w_{2} ^{3}} & \frac{ - a_{1}}{w_{2}} & \frac{ - a_{2}}{w_{2}} & \frac{ - a_{3}}{w_{2}} \\ \frac{ - a_{1}}{w_{2}} & \frac{1}{w_{2}} & 0 & 0 \\ \frac{ - a_{2}}{w_{2}} & 0 & \frac{1}{w_{2}} & 0 \\ \frac{ - a_{3}}{w_{2}} & 0 & 0 & \frac{1}{w_{2}} \end{array} \right) \\ V_2 &= \left( \begin{array}{cccc} w_{1} & w_{1} a_{1} & w_{1} a_{2} & w_{1} a_{3} \\ a_{1} w_{1} & w_{1} a_{1} ^{2} + w_{2} & a_{1} w_{1} a_{2} & a_{1} w_{1} a_{3} \\ a_{2} w_{1} & a_{2} w_{1} a_{1} & w_{1} a_{2} ^{2} + w_{2} & a_{2} w_{1} a_{3} \\ a_{3} w_{1} & a_{3} w_{1} a_{1} & a_{3} w_{1} a_{2} & w_{1} a_{3} ^{2} + w_{2} \end{array} \right) \end{align}\]
These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.