1 Matrix Algebra Variation and Likelihood Michael C Neale Virginia Institute for Psychiatric and...
-
Upload
mary-flowers -
Category
Documents
-
view
215 -
download
0
Transcript of 1 Matrix Algebra Variation and Likelihood Michael C Neale Virginia Institute for Psychiatric and...
![Page 1: 1 Matrix Algebra Variation and Likelihood Michael C Neale Virginia Institute for Psychiatric and Behavioral Genetics VCU International Workshop on Methodology.](https://reader035.fdocuments.net/reader035/viewer/2022070413/5697bfd21a28abf838cab99d/html5/thumbnails/1.jpg)
1
Matrix AlgebraVariation and Likelihood
Michael C NealeVirginia Institute for Psychiatric and Behavioral Genetics VCU
International Workshop on Methodology for Genetic Studies
Boulder Colorado 2nd March 2010 1
![Page 2: 1 Matrix Algebra Variation and Likelihood Michael C Neale Virginia Institute for Psychiatric and Behavioral Genetics VCU International Workshop on Methodology.](https://reader035.fdocuments.net/reader035/viewer/2022070413/5697bfd21a28abf838cab99d/html5/thumbnails/2.jpg)
2
Overview Matrix multiplication review
Variation & covariation
Likelihood Theory
Practical
![Page 3: 1 Matrix Algebra Variation and Likelihood Michael C Neale Virginia Institute for Psychiatric and Behavioral Genetics VCU International Workshop on Methodology.](https://reader035.fdocuments.net/reader035/viewer/2022070413/5697bfd21a28abf838cab99d/html5/thumbnails/3.jpg)
3
Three Kinds of Matrix Multiplication Dot/Hadamard: element by element
In R use *ncol(A) = ncol(B) AND nrow(A) = nrow(B)
Ordinary matrix multiplication In R use %*%# of columns in A = # of rows in B
Kronecker multiplication In R use %x%No conformability conditions
http://en.wikipedia.org/wiki/Matrix_multiplication#Ordinary_matrix_product
![Page 4: 1 Matrix Algebra Variation and Likelihood Michael C Neale Virginia Institute for Psychiatric and Behavioral Genetics VCU International Workshop on Methodology.](https://reader035.fdocuments.net/reader035/viewer/2022070413/5697bfd21a28abf838cab99d/html5/thumbnails/4.jpg)
4
Dot or Hadamard Multiplication
6 x 2
7 x 3 8 x 4
5 x 1
i,j i,j i,j
![Page 5: 1 Matrix Algebra Variation and Likelihood Michael C Neale Virginia Institute for Psychiatric and Behavioral Genetics VCU International Workshop on Methodology.](https://reader035.fdocuments.net/reader035/viewer/2022070413/5697bfd21a28abf838cab99d/html5/thumbnails/5.jpg)
5
Ordinary Multiplication
Multiply: A (m x n) by B (n by p)
![Page 6: 1 Matrix Algebra Variation and Likelihood Michael C Neale Virginia Institute for Psychiatric and Behavioral Genetics VCU International Workshop on Methodology.](https://reader035.fdocuments.net/reader035/viewer/2022070413/5697bfd21a28abf838cab99d/html5/thumbnails/6.jpg)
6
Ordinary Multiplication I
![Page 7: 1 Matrix Algebra Variation and Likelihood Michael C Neale Virginia Institute for Psychiatric and Behavioral Genetics VCU International Workshop on Methodology.](https://reader035.fdocuments.net/reader035/viewer/2022070413/5697bfd21a28abf838cab99d/html5/thumbnails/7.jpg)
7
Ordinary Multiplication II
![Page 8: 1 Matrix Algebra Variation and Likelihood Michael C Neale Virginia Institute for Psychiatric and Behavioral Genetics VCU International Workshop on Methodology.](https://reader035.fdocuments.net/reader035/viewer/2022070413/5697bfd21a28abf838cab99d/html5/thumbnails/8.jpg)
8
Ordinary Multiplication III
![Page 9: 1 Matrix Algebra Variation and Likelihood Michael C Neale Virginia Institute for Psychiatric and Behavioral Genetics VCU International Workshop on Methodology.](https://reader035.fdocuments.net/reader035/viewer/2022070413/5697bfd21a28abf838cab99d/html5/thumbnails/9.jpg)
9
Ordinary Multiplication IV
![Page 10: 1 Matrix Algebra Variation and Likelihood Michael C Neale Virginia Institute for Psychiatric and Behavioral Genetics VCU International Workshop on Methodology.](https://reader035.fdocuments.net/reader035/viewer/2022070413/5697bfd21a28abf838cab99d/html5/thumbnails/10.jpg)
10
Ordinary Multiplication V
![Page 11: 1 Matrix Algebra Variation and Likelihood Michael C Neale Virginia Institute for Psychiatric and Behavioral Genetics VCU International Workshop on Methodology.](https://reader035.fdocuments.net/reader035/viewer/2022070413/5697bfd21a28abf838cab99d/html5/thumbnails/11.jpg)
11
Ordinary Multiplication VI
![Page 12: 1 Matrix Algebra Variation and Likelihood Michael C Neale Virginia Institute for Psychiatric and Behavioral Genetics VCU International Workshop on Methodology.](https://reader035.fdocuments.net/reader035/viewer/2022070413/5697bfd21a28abf838cab99d/html5/thumbnails/12.jpg)
12
Ordinary Multiplication VII
![Page 13: 1 Matrix Algebra Variation and Likelihood Michael C Neale Virginia Institute for Psychiatric and Behavioral Genetics VCU International Workshop on Methodology.](https://reader035.fdocuments.net/reader035/viewer/2022070413/5697bfd21a28abf838cab99d/html5/thumbnails/13.jpg)
13
Kronecker or Direct Product
![Page 14: 1 Matrix Algebra Variation and Likelihood Michael C Neale Virginia Institute for Psychiatric and Behavioral Genetics VCU International Workshop on Methodology.](https://reader035.fdocuments.net/reader035/viewer/2022070413/5697bfd21a28abf838cab99d/html5/thumbnails/14.jpg)
14
Kronecker or Direct Product
![Page 15: 1 Matrix Algebra Variation and Likelihood Michael C Neale Virginia Institute for Psychiatric and Behavioral Genetics VCU International Workshop on Methodology.](https://reader035.fdocuments.net/reader035/viewer/2022070413/5697bfd21a28abf838cab99d/html5/thumbnails/15.jpg)
15
Summarizing Variation and Likelihood
15
![Page 16: 1 Matrix Algebra Variation and Likelihood Michael C Neale Virginia Institute for Psychiatric and Behavioral Genetics VCU International Workshop on Methodology.](https://reader035.fdocuments.net/reader035/viewer/2022070413/5697bfd21a28abf838cab99d/html5/thumbnails/16.jpg)
16
Computing Mean
• Formula (xi)/N
• Can compute with • Pencil
• Calculator• SAS
• SPSS• R mean(dataframe)
• OpenMx16
![Page 17: 1 Matrix Algebra Variation and Likelihood Michael C Neale Virginia Institute for Psychiatric and Behavioral Genetics VCU International Workshop on Methodology.](https://reader035.fdocuments.net/reader035/viewer/2022070413/5697bfd21a28abf838cab99d/html5/thumbnails/17.jpg)
17
Variance: elementary probability theory2 outcomes
Heads Tails
Outcome
0
0.1
0.2
0.3
0.4
0.5
0.6Probability
![Page 18: 1 Matrix Algebra Variation and Likelihood Michael C Neale Virginia Institute for Psychiatric and Behavioral Genetics VCU International Workshop on Methodology.](https://reader035.fdocuments.net/reader035/viewer/2022070413/5697bfd21a28abf838cab99d/html5/thumbnails/18.jpg)
18
Two Coin toss3 outcomes
HH HT/TH TT
Outcome
0
0.1
0.2
0.3
0.4
0.5
0.6Probability
![Page 19: 1 Matrix Algebra Variation and Likelihood Michael C Neale Virginia Institute for Psychiatric and Behavioral Genetics VCU International Workshop on Methodology.](https://reader035.fdocuments.net/reader035/viewer/2022070413/5697bfd21a28abf838cab99d/html5/thumbnails/19.jpg)
19
Four Coin toss5 outcomes
HHHH HHHT HHTT HTTT TTTT
Outcome
0
0.1
0.2
0.3
0.4Probability
![Page 20: 1 Matrix Algebra Variation and Likelihood Michael C Neale Virginia Institute for Psychiatric and Behavioral Genetics VCU International Workshop on Methodology.](https://reader035.fdocuments.net/reader035/viewer/2022070413/5697bfd21a28abf838cab99d/html5/thumbnails/20.jpg)
20
Ten Coin toss9 outcomes
Outcome
0
0.05
0.1
0.15
0.2
0.25
0.3Probability
![Page 21: 1 Matrix Algebra Variation and Likelihood Michael C Neale Virginia Institute for Psychiatric and Behavioral Genetics VCU International Workshop on Methodology.](https://reader035.fdocuments.net/reader035/viewer/2022070413/5697bfd21a28abf838cab99d/html5/thumbnails/21.jpg)
21
Fort Knox Toss
0 1 2 3 4-1-2-3-4Heads-Tails
0
0.1
0.2
0.3
0.4
0.5
De Moivre 1733 Gauss 1827
Infinite outcomes
![Page 22: 1 Matrix Algebra Variation and Likelihood Michael C Neale Virginia Institute for Psychiatric and Behavioral Genetics VCU International Workshop on Methodology.](https://reader035.fdocuments.net/reader035/viewer/2022070413/5697bfd21a28abf838cab99d/html5/thumbnails/22.jpg)
22
Dinosaur (of a) Joke Elk: The Theory by A. Elk
brackets Miss brackets. My theory is along the following lines.
Host: Oh God.
Elk: All brontosauruses are thin
at one end, much MUCH thicker in the middle, and then thin again at the far end.
http://www.youtube.com/watch?v=cAYDiPizDIs
22
![Page 23: 1 Matrix Algebra Variation and Likelihood Michael C Neale Virginia Institute for Psychiatric and Behavioral Genetics VCU International Workshop on Methodology.](https://reader035.fdocuments.net/reader035/viewer/2022070413/5697bfd21a28abf838cab99d/html5/thumbnails/23.jpg)
23
Pascal's Triangle
Pascal's friend Chevalier de Mere 1654; Huygens 1657; Cardan 1501-1576
11 1
1 2 11 3 3 1
1 4 6 4 11 5 10 10 5 1
1 6 15 20 15 6 11 7 21 35 35 21 7 1
1/11/21/41/81/161/321/641/128
Frequency Probability
![Page 24: 1 Matrix Algebra Variation and Likelihood Michael C Neale Virginia Institute for Psychiatric and Behavioral Genetics VCU International Workshop on Methodology.](https://reader035.fdocuments.net/reader035/viewer/2022070413/5697bfd21a28abf838cab99d/html5/thumbnails/24.jpg)
24
Variance
Measure of Spread
Easily calculated
Individual differences
![Page 25: 1 Matrix Algebra Variation and Likelihood Michael C Neale Virginia Institute for Psychiatric and Behavioral Genetics VCU International Workshop on Methodology.](https://reader035.fdocuments.net/reader035/viewer/2022070413/5697bfd21a28abf838cab99d/html5/thumbnails/25.jpg)
25
Average squared deviationNormal distribution
0 1 2 3-1-2-3
xi
di
Variance =di2/N
![Page 26: 1 Matrix Algebra Variation and Likelihood Michael C Neale Virginia Institute for Psychiatric and Behavioral Genetics VCU International Workshop on Methodology.](https://reader035.fdocuments.net/reader035/viewer/2022070413/5697bfd21a28abf838cab99d/html5/thumbnails/26.jpg)
26
Measuring Variation
• Absolute differences?
• Squared differences?
• Absolute cubed?
• Squared squared?
Weighs & Means
?
![Page 27: 1 Matrix Algebra Variation and Likelihood Michael C Neale Virginia Institute for Psychiatric and Behavioral Genetics VCU International Workshop on Methodology.](https://reader035.fdocuments.net/reader035/viewer/2022070413/5697bfd21a28abf838cab99d/html5/thumbnails/27.jpg)
27
• Squared differences
Fisher (1922) On the mathematical foundations of theoretical statistics. Phil Trans Roy Soc London A222:309-368
Squared has minimum variance under normal distribution
Measuring VariationWeighs & Means
![Page 28: 1 Matrix Algebra Variation and Likelihood Michael C Neale Virginia Institute for Psychiatric and Behavioral Genetics VCU International Workshop on Methodology.](https://reader035.fdocuments.net/reader035/viewer/2022070413/5697bfd21a28abf838cab99d/html5/thumbnails/28.jpg)
28
Covariance
• Measure of association between two variables
• Closely related to variance
• Useful to partition variance
28
![Page 29: 1 Matrix Algebra Variation and Likelihood Michael C Neale Virginia Institute for Psychiatric and Behavioral Genetics VCU International Workshop on Methodology.](https://reader035.fdocuments.net/reader035/viewer/2022070413/5697bfd21a28abf838cab99d/html5/thumbnails/29.jpg)
29
Deviations in two dimensionsx
y
![Page 30: 1 Matrix Algebra Variation and Likelihood Michael C Neale Virginia Institute for Psychiatric and Behavioral Genetics VCU International Workshop on Methodology.](https://reader035.fdocuments.net/reader035/viewer/2022070413/5697bfd21a28abf838cab99d/html5/thumbnails/30.jpg)
30
Deviations in two dimensionsx
y
dx
dy
![Page 31: 1 Matrix Algebra Variation and Likelihood Michael C Neale Virginia Institute for Psychiatric and Behavioral Genetics VCU International Workshop on Methodology.](https://reader035.fdocuments.net/reader035/viewer/2022070413/5697bfd21a28abf838cab99d/html5/thumbnails/31.jpg)
31
Measuring Covariation
• A square, perimeter 4• Area 1
Concept: Area of a rectangle
1
1
![Page 32: 1 Matrix Algebra Variation and Likelihood Michael C Neale Virginia Institute for Psychiatric and Behavioral Genetics VCU International Workshop on Methodology.](https://reader035.fdocuments.net/reader035/viewer/2022070413/5697bfd21a28abf838cab99d/html5/thumbnails/32.jpg)
32
Measuring Covariation
• A skinny rectangle, perimeter 4• Area .25*1.75 = .4385
Concept: Area of a rectangle
1.75
.25
![Page 33: 1 Matrix Algebra Variation and Likelihood Michael C Neale Virginia Institute for Psychiatric and Behavioral Genetics VCU International Workshop on Methodology.](https://reader035.fdocuments.net/reader035/viewer/2022070413/5697bfd21a28abf838cab99d/html5/thumbnails/33.jpg)
33
Measuring Covariation
• Points can contribute negatively• Area -.25*1.75 = -.4385
Concept: Area of a rectangle
1.75
-.25
![Page 34: 1 Matrix Algebra Variation and Likelihood Michael C Neale Virginia Institute for Psychiatric and Behavioral Genetics VCU International Workshop on Methodology.](https://reader035.fdocuments.net/reader035/viewer/2022070413/5697bfd21a28abf838cab99d/html5/thumbnails/34.jpg)
34
Measuring Covariation
Covariance Formula: Average cross-product of deviations from mean
= (xi - x)(yi - y) xy
N
![Page 35: 1 Matrix Algebra Variation and Likelihood Michael C Neale Virginia Institute for Psychiatric and Behavioral Genetics VCU International Workshop on Methodology.](https://reader035.fdocuments.net/reader035/viewer/2022070413/5697bfd21a28abf838cab99d/html5/thumbnails/35.jpg)
35
Correlation
• Standardized covariance• Lies between -1 and 1
r = xy xy
22
yx *
![Page 36: 1 Matrix Algebra Variation and Likelihood Michael C Neale Virginia Institute for Psychiatric and Behavioral Genetics VCU International Workshop on Methodology.](https://reader035.fdocuments.net/reader035/viewer/2022070413/5697bfd21a28abf838cab99d/html5/thumbnails/36.jpg)
36
SummaryFormulae for sample statistics; i=1…N observations
= (xi)/N
x = (xi - x ) / (N)2 2
r = xy xy
22
xx
xy= (xi-x )(yi-y ) / (N)
![Page 37: 1 Matrix Algebra Variation and Likelihood Michael C Neale Virginia Institute for Psychiatric and Behavioral Genetics VCU International Workshop on Methodology.](https://reader035.fdocuments.net/reader035/viewer/2022070413/5697bfd21a28abf838cab99d/html5/thumbnails/37.jpg)
37
Variance covariance matrixSeveral variables
Var(X) Cov(X,Y) Cov(X,Z)
Cov(X,Y) Var(Y) Cov(Y,Z)
Cov(X,Z) Cov(Y,Z) Var(Z)
![Page 38: 1 Matrix Algebra Variation and Likelihood Michael C Neale Virginia Institute for Psychiatric and Behavioral Genetics VCU International Workshop on Methodology.](https://reader035.fdocuments.net/reader035/viewer/2022070413/5697bfd21a28abf838cab99d/html5/thumbnails/38.jpg)
38
Variance covariance matrixUnivariate Twin Data
Var(Twin1) Cov(Twin1,Twin2)
Cov(Twin2,Twin1) Var(Twin2)
Only suitable for complete dataGood conceptual perspective
![Page 39: 1 Matrix Algebra Variation and Likelihood Michael C Neale Virginia Institute for Psychiatric and Behavioral Genetics VCU International Workshop on Methodology.](https://reader035.fdocuments.net/reader035/viewer/2022070413/5697bfd21a28abf838cab99d/html5/thumbnails/39.jpg)
39
Conclusion
• Means and covariances
• Basic input statistics for “Traditional SEM”
• Easy to compute
• Can use raw data instead
39
![Page 40: 1 Matrix Algebra Variation and Likelihood Michael C Neale Virginia Institute for Psychiatric and Behavioral Genetics VCU International Workshop on Methodology.](https://reader035.fdocuments.net/reader035/viewer/2022070413/5697bfd21a28abf838cab99d/html5/thumbnails/40.jpg)
40
Likelihood: Normal TheoryCalculate height of curve
-1
40
![Page 41: 1 Matrix Algebra Variation and Likelihood Michael C Neale Virginia Institute for Psychiatric and Behavioral Genetics VCU International Workshop on Methodology.](https://reader035.fdocuments.net/reader035/viewer/2022070413/5697bfd21a28abf838cab99d/html5/thumbnails/41.jpg)
41
Height of normal curveProbability density function
0 1 2 3-1-2-3
x
xi
(xi)
(xi) is the likelihood of data point xi
for particular mean & variance estimates
![Page 42: 1 Matrix Algebra Variation and Likelihood Michael C Neale Virginia Institute for Psychiatric and Behavioral Genetics VCU International Workshop on Methodology.](https://reader035.fdocuments.net/reader035/viewer/2022070413/5697bfd21a28abf838cab99d/html5/thumbnails/42.jpg)
4242
![Page 43: 1 Matrix Algebra Variation and Likelihood Michael C Neale Virginia Institute for Psychiatric and Behavioral Genetics VCU International Workshop on Methodology.](https://reader035.fdocuments.net/reader035/viewer/2022070413/5697bfd21a28abf838cab99d/html5/thumbnails/43.jpg)
43
xi43
![Page 44: 1 Matrix Algebra Variation and Likelihood Michael C Neale Virginia Institute for Psychiatric and Behavioral Genetics VCU International Workshop on Methodology.](https://reader035.fdocuments.net/reader035/viewer/2022070413/5697bfd21a28abf838cab99d/html5/thumbnails/44.jpg)
44
Height of bivariate normal curveAn unlikely pair of (x,y) values
x xi
-3 -2 -1 0 1 2 3 -3-2
-10
12
3
0.30.40.5
yi
y
![Page 45: 1 Matrix Algebra Variation and Likelihood Michael C Neale Virginia Institute for Psychiatric and Behavioral Genetics VCU International Workshop on Methodology.](https://reader035.fdocuments.net/reader035/viewer/2022070413/5697bfd21a28abf838cab99d/html5/thumbnails/45.jpg)
45
R graphics: http://addictedtor.free.fr/graphiques/
45
![Page 46: 1 Matrix Algebra Variation and Likelihood Michael C Neale Virginia Institute for Psychiatric and Behavioral Genetics VCU International Workshop on Methodology.](https://reader035.fdocuments.net/reader035/viewer/2022070413/5697bfd21a28abf838cab99d/html5/thumbnails/46.jpg)
mu1<-0 # set the expected value of x1mu2<-0 # set the expected value of x2s11<-10 # set the variance of x1s22<-10 # set the variance of x2rho<-0.0 # set the correlation coefficient between x1 and x2x1<-seq(-10,10,length=41) # generate series for values of x1 & x2x2<-x1 # copy x1 to x2
# set up the bivariate normal density function - could use f<-function(x1,x2){
term1 <- 1/(2*pi*sqrt(s11*s22*(1-rho^2)))term2 <- -1/(2*(1-rho^2))term3 <- (x1-mu1)^2/s11term4 <- (x2-mu2)^2/s22term5 <- -2*rho*((x1-mu1)*(x2-mu2))/(sqrt(s11)*sqrt(s22))term1*exp(term2*(term3+term4-term5))
}
# calculate the density values z<-outer(x1,x2,f)
# generate the 3-D plotpersp(x1, x2, z, main="Two dimensional Normal Distribution", sub=expression(italic(f)~(bold(x))==frac(1,2~pi~sqrt(sigma[11]~ sigma[22]~(1-rho^2)))~phantom(0)~exp~bgroup("{",
list(-frac(1,2(1-rho^2)), bgroup("[", frac((x[1]~-~mu[1])^2, sigma[11])~-~2~rho~frac(x[1]~-~mu[1], sqrt(sigma[11]))~ frac(x[2]~-~mu[2],sqrt(sigma[22]))~+~ frac((x[2]~-~mu[2])^2, sigma[22]),"]")),"}")),
col="lightblue", theta=30, phi=20, r=50, d=0.1, expand=0.5, ltheta=90, lphi=180, shade=0.75, ticktype="detailed", nticks=5)
# adding a text line to the graphmtext(expression(list(mu[1]==0,mu[2]==0,sigma[11]==10,sigma[22]==10,sigma[12]==15,rho==0.0)), side=3)
46
![Page 47: 1 Matrix Algebra Variation and Likelihood Michael C Neale Virginia Institute for Psychiatric and Behavioral Genetics VCU International Workshop on Methodology.](https://reader035.fdocuments.net/reader035/viewer/2022070413/5697bfd21a28abf838cab99d/html5/thumbnails/47.jpg)
4747
Text
![Page 48: 1 Matrix Algebra Variation and Likelihood Michael C Neale Virginia Institute for Psychiatric and Behavioral Genetics VCU International Workshop on Methodology.](https://reader035.fdocuments.net/reader035/viewer/2022070413/5697bfd21a28abf838cab99d/html5/thumbnails/48.jpg)
48
Exercises: Compute Normal PDF
Get used to OpenMx script language
Use matrix algebra
Taste of likelihood theory
48