File: mxPearsonSelCov.Rd

package info (click to toggle)
r-cran-openmx 2.21.1%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 14,412 kB
  • sloc: cpp: 36,577; ansic: 13,811; fortran: 2,001; sh: 1,440; python: 350; perl: 21; makefile: 5
file content (87 lines) | stat: -rw-r--r-- 3,009 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
\name{mxPearsonSelCov}
\alias{mxPearsonSelCov}
\alias{mxPearsonSelMean}

\title{Perform Pearson Aitken selection}

\description{
\lifecycle{maturing}
   These functions implement the Pearson Aitken selection formulae.
}

\usage{
mxPearsonSelCov(origCov, newCov)
mxPearsonSelMean(origCov, newCov, origMean)
}

\arguments{
\item{origCov}{covariance matrix. The covariance prior to selection.}
\item{newCov}{covariance matrix. A subset of \code{origCov} to replace.}
\item{origMean}{column vector. A mean vector to adjust.}
}

\details{
  Which dimensions to condition on can be communicated in one
  of two ways: (1) \code{newCov} is a submatrix of \code{origCov}.
  The dimnames are matched to determine which
  partition of \code{origCov} to replace with \code{newCov}.
  Or (2) \code{newCov} is the same dimension as \code{origCov}.
  The matrix entries are inspected to determine which entries have
  changed. The changed entries determine which partition of
\code{origCov} to replace with \code{newCov}.

Let the \eqn{n \times n} covariance matrix R (\code{origCov}) be partitioned into non-empty,
disjoint sets p and q.
Let \eqn{R_{ij}} denote the covariance matrix between the p
and q variables where the subscripts denote the variable subsets (e.g. \eqn{R_{pq}}).
Let column vectors \eqn{\mu_p} and \eqn{\mu_q} contain the means of p and q
variables, respectively.
We wish to compute the conditional covariances of the variables in q
for a subset of the population where \eqn{R_{pp}} and \eqn{\mu_p} are known (or partially known)---that is, we wish
to \emph{condition} the covariances and means of q on those of p.
Let \eqn{V_{pp}} (\code{newCov}) be an arbitrary covariance matrix of the same
dimension as \eqn{R_{pp}}.
If we replace \eqn{R_{pp}} by \eqn{V_{pp}} then the mean
of q (\code{origMean}) is transformed as
  \deqn{\mu_q \to \mu_q + R_{qp} R_{pp}^{-1} \mu_p}{See PDF version}
and the covariance of p and q are transformed as
  \deqn{\left[
\begin{array}{c|c}
R_{pp} & R_{pq} \\
\hline
R_{qp} & R_{qq}
\end{array}
\right] \to
\left[
\begin{array}{c|c}
V_{pp} & V_{pp}R_{pp}^{-1}R_{pq} \\
\hline
R_{qp}R_{pp}^{-1}V_{pp} & R_{qq}-R_{qp} (R_{pp}^{-1} - R_{pp}^{-1} V_{pp} R_{pp}^{-1}) R_{pq}
\end{array}
\right]}{See PDF version}

}

\references{
Aitken, A. (1935). Note on selection from a multivariate normal population. \emph{Proceedings of
the Edinburgh Mathematical Society (Series 2), 4}(2), 106-110.
doi:10.1017/S0013091500008063
}

\examples{
library(OpenMx)

m1 <- mxModel(
  'selectionTest',
  mxMatrix('Full', 10, 10, values=rWishart(1, 20, toeplitz((10:1)/10))[,,1],
           dimnames=list(paste0('c',1:10),paste0('c',1:10)), name="m1"),
  mxMatrix('Full', 2, 2, values=diag(2),
           dimnames=list(paste0('c',1:2),paste0('c',1:2)), name="m2"),
  mxMatrix('Full', 10, 1, values=runif(10),
           dimnames=list(paste0('c',1:10),c('v')), name="u1"),
  mxAlgebra(mxPearsonSelCov(m1, m2), name="c1"),
  mxAlgebra(mxPearsonSelMean(m1, m2, u1), name="u2")
)

m1 <- mxRun(m1)
}