shape_8 <- read.csv("Condyle_kurz_vs2.csv", header=T, sep=";")
C_shape <- shape_8[which(shape_8$Species2 == 'C'), ]
D_shape <- shape_8[which(shape_8$Species2 == 'D'), ]
D3_shape <- shape_8[which(shape_8$Species2 == 'D3'), ]
E_shape <- shape_8[which(shape_8$Species2 == 'E'), ]
F_shape <- shape_8[which(shape_8$Species2 == 'F'), ]
G_shape <- shape_8[which(shape_8$Species2 == 'G'), ]
M_shape <- shape_8[which(shape_8$Species2 == 'M'), ]
M_shape <- M_shape[-24, ] #specimen not adequately oriented during photography
N_shape <- shape_8[which(shape_8$Species2 == 'N'), ]
T_shape <- shape_8[which(shape_8$Species2 == 'T'), ]
X1_shape <- shape_8[which(shape_8$Species2 == 'X1'), ]
X10_shape <- shape_8[which(shape_8$Species2 == 'X10'), ]
X11_shape <- shape_8[which(shape_8$Species2 == 'X11'), ]
dictyon_mean <- cbind("dictyon", as.data.frame(t(colMeans(shape_8[c(243:245), c(2:15)]))),"dictyon_mean","dictyon_mean", "mean")
colnames(dictyon_mean)[1:18] <- c("collection","A2","A3","A4","A5","A6","A7","A8","B2","B3","B4","B5","B6","B7","B8","Species","Species2","Sex")
berneyi_mean <- cbind("berneyi", as.data.frame(t(colMeans(shape_8[c(213:215), c(2:15)]))),"berneyi_mean","berneyi_mean", "mean")
colnames(berneyi_mean)[1:18] <- c("collection","A2","A3","A4","A5","A6","A7","A8","B2","B3","B4","B5","B6","B7","B8","Species","Species2","Sex")
All <- as.data.frame(rbind(C_shape, D_shape, D3_shape, E_shape, F_shape, G_shape, M_shape, N_shape, T_shape, X1_shape, X10_shape, X11_shape))
All_types <- as.data.frame(rbind(C_shape, D_shape, D3_shape, E_shape, F_shape, G_shape, M_shape, N_shape, T_shape, X1_shape, X10_shape, X11_shape, shape_8[c(1:3, 213:215, 241:249),]))
C_dictyon_lutraria_type <- as.data.frame(rbind(C_shape, shape_8[c(243:248),], dictyon_mean))
D_D3_rubra_elliptica <- as.data.frame(rbind(D_shape, D3_shape, shape_8[c(1, 241),]))
M_N_berneyi <- as.data.frame(rbind(M_shape, N_shape, shape_8[c(213:215),], berneyi_mean))
Pearson product moment correlation coefficient, following SOGA page 19/104.
pairs.panels(All[2:15], smooth = F, ellipses = T)
n = 30
set.seed(333)
sample.idx <- sample(1:nrow(C_shape), size = n)
vars <- c("A2","A3","A4","A5","A6","A7","A8","B2","B3","B4","B5","B6","B7","B8")
pairs.panels(C_shape[sample.idx, vars], smooth = F, ellipses = F,
main = 'Pearson product moment correlation coefficient for species C')
pairs.panels(D_shape[2:15], smooth = F, ellipses = F,
main = 'Pearson product moment correlation coefficient for species D')
pairs.panels(D3_shape[2:15], smooth = F, ellipses = F,
main = 'Pearson product moment correlation coefficient for species D3')
pairs.panels(E_shape[2:15], smooth = F, ellipses = F,
main = 'Pearson product moment correlation coefficient for species E')
pairs.panels(F_shape[2:15], smooth = F, ellipses = F,
main = 'Pearson product moment correlation coefficient for species F')
pairs.panels(G_shape[2:15], smooth = F, ellipses = F,
main = 'Pearson product moment correlation coefficient for species G')
n = 29
set.seed(333)
sample.idx <- sample(1:nrow(M_shape), size = n)
vars <- c("A2","A3","A4","A5","A6","A7","A8","B2","B3","B4","B5","B6","B7","B8")
pairs.panels(M_shape[sample.idx, vars], smooth = F, ellipses = F,
main = 'Pearson product moment correlation coefficient for species M')
n = 30
set.seed(333)
sample.idx <- sample(1:nrow(N_shape), size = n)
vars <- c("A2","A3","A4","A5","A6","A7","A8","B2","B3","B4","B5","B6","B7","B8")
pairs.panels(N_shape[sample.idx, vars], smooth = F, ellipses = F,
main = 'Pearson product moment correlation coefficient for species N')
pairs.panels(T_shape[2:15], smooth = F, ellipses = F,
main = 'Pearson product moment correlation coefficient for species T')
pairs.panels(X1_shape[2:15], smooth = F, ellipses = F,
main = 'Pearson product moment correlation coefficient for species X1')
pairs.panels(X10_shape[2:15], smooth = F, ellipses = F,
main = 'Pearson product moment correlation coefficient for species X10')
pairs.panels(X11_shape[2:15], smooth = F, ellipses = F,
main = 'Pearson product moment correlation coefficient for species X11')
All.pca <- princomp(All[c(2:15)])
ggord(All.pca, All$Species2,size = 2.5, vec_ext=0.03, axes = c("1", "2"), hull = TRUE, ellipse=FALSE, arrow = 0) #+ xlim(-0.08,0.07) + ylim(-0.075, 0.03)
ggord(All.pca, All$Species2,size = 2.5, vec_ext=0.03, axes = c("1", "3"), hull = TRUE, ellipse=FALSE, arrow = 0) #+ xlim(-0.08,0.07) + ylim(-0.04, 0.045)
PC1, PC2, and PC3 explain 65.1%, 9.8%, and 7.7% of the variance in the dataset, respectively.
All_types.pca <- princomp(All_types[c(2:15)])
ggord(All_types.pca, All_types$Species2,size = 2.5, vec_ext=0.03,axes = c("1", "2"), hull = TRUE, ellipse=FALSE, arrow = 0) #+ xlim(-0.08,0.07) + ylim(-0.075, 0.04)
ggord(All_types.pca, All_types$Species2,size = 2.5, vec_ext=0.03,axes = c("2", "3"), hull = TRUE, ellipse=FALSE, arrow = 0) #+ xlim(-0.075,0.0375) + ylim(-0.04, 0.045)
Biplot of scores and loadings on PC1 and PC2 as well as PC2 and PC3. PC1, PC2, and PC3 explain 63.0%, 11.5%, and 7.4% of the variance in the dataset, respectively. T and X10 yield similar shapes on the PC1 vs PC2 plane, but are clearly separated on the PC2 vs PC3 plane. X10 can be assigned to Ozestheria rufa following their overlap on the PC2 vs PC3 plane.
C_dictyon_lutraria_type.pca <- princomp(C_dictyon_lutraria_type[c(2:15)])
ggord(C_dictyon_lutraria_type.pca, C_dictyon_lutraria_type$Species2,size = 2.5, vec_ext=0.03,axes = c("1", "2"), hull = TRUE, ellipse=FALSE, arrow = 0)
lutraria_drawing = drawing of lutraria in Brady (1886) lutraria = lutraria specimens J53362a, b
D_D3_rubra_elliptica.pca <- princomp(D_D3_rubra_elliptica[c(2:15)])
ggord(D_D3_rubra_elliptica.pca, D_D3_rubra_elliptica$Species2,size = 2.5, vec_ext=0.03,axes = c("1", "2"), hull = TRUE, ellipse=FALSE, arrow = 0)
M_N_berneyi.pca <- princomp(M_N_berneyi[c(2:15)])
ggord(M_N_berneyi.pca, M_N_berneyi$Species2,size = 2.5, vec_ext=0.03,axes = c("1", "2"), hull = TRUE, ellipse=FALSE, arrow = 0)
ggord(M_N_berneyi.pca, M_N_berneyi$Species2,size = 2.5, vec_ext=0.03,axes = c("2", "3"), hull = TRUE, ellipse=FALSE, arrow = 0)
The type of Ozestheria berneyi (lower left corner in the PC1 vs PC2 plot) is an outlier to both M and N.
All.lda <- lda(Species2 ~ A2+A3+A4+A5+A6+A7+A8+B2+B3+B4+B5+B6+B7+B8, method = "moment", data = All, na.action = na.omit)
All.lda.values <- predict(All.lda)
ggord(All.lda, All$Species2,size = 2.5, vec_ext=0.03,axes = c("1", "2"), hull = TRUE, ellipse=FALSE, arrow = 0)
ggord(All.lda, All$Species2,size = 2.5, vec_ext=0.03,axes = c("2", "3"), hull = TRUE, ellipse=FALSE, arrow = 0)
LD1, LD2, and LD3 explain 77.9%, 9.4%, and 7.2% of the between-group variance, respectively.
All_types.lda <- lda(Species2 ~ A2+A3+A4+A5+A6+A7+A8+B2+B3+B4+B5+B6+B7+B8, method = "moment", data = All_types, na.action = na.omit)
All_types.lda.values <- predict(All_types.lda)
ggord(All_types.lda, All_types$Species2,size = 2.5, vec_ext=0.03,axes = c("1", "2"), hull = TRUE, ellipse=FALSE, arrow = 0)
ggord(All_types.lda, All_types$Species2,size = 2.5, vec_ext=0.03,axes = c("1", "3"), hull = TRUE, ellipse=FALSE, arrow = 0)
C_dictyon_lutraria_type.lda <- lda(Species2 ~ A2+A3+A4+A5+A6+A7+A8+B2+B3+B4+B5+B6+B7+B8, method = "moment", data = C_dictyon_lutraria_type, na.action = na.omit)
C_dictyon_lutraria_type.lda.values <- predict(C_dictyon_lutraria_type.lda)
ggord(C_dictyon_lutraria_type.lda, C_dictyon_lutraria_type$Species2,size = 2.5, vec_ext=0.01,axes = c("1", "2"), hull = TRUE, ellipse=FALSE, arrow = 0)
lutraria_drawing = drawing of lutraria in Brady (1886) lutraria = lutraria specimens J53362a, b
D_D3_rubra_elliptica.lda <- lda(Species2 ~ A2+A3+A4+A5+A6+A7+A8+B2+B3+B4+B5+B6+B7+B8, method = "moment", data = D_D3_rubra_elliptica, na.action = na.omit)
D_D3_rubra_elliptica.lda.values <- predict(D_D3_rubra_elliptica.lda)
ggord(D_D3_rubra_elliptica.lda, D_D3_rubra_elliptica$Species2,size = 2.5, vec_ext=0.01,axes = c("1", "2"), hull = TRUE, ellipse=FALSE, arrow = 0)
M_N_berneyi.lda <- lda(Species2 ~ A2+A3+A4+A5+A6+A7+A8+B2+B3+B4+B5+B6+B7+B8, method = "moment", data = M_N_berneyi, na.action = na.omit)
M_N_berneyi.lda.values <- predict(M_N_berneyi.lda)
ggord(M_N_berneyi.lda, M_N_berneyi$Species2,size = 2.5, vec_ext=0.01,axes = c("1", "2"), hull = TRUE, ellipse=FALSE, arrow = 0)
The type of Ozestheria berneyi (lower left corner in the LD1 vs LD2 plot) is an outlier to both M and N, only the female shape is associated with N.
Following Boedeker and Kearns (2019) Linear Discriminant Analysis for prediction of group membership
options(width = 120)
n.class <- 12
p <- 14 #number of predictors
N <- 233
### means of Fourier coefficients (predictors) within species (class) ###
mean.C <- c(mean(C_shape$A2), mean(C_shape$A3),mean(C_shape$A4),mean(C_shape$A5),mean(C_shape$A6),mean(C_shape$A7),mean(C_shape$A8), mean(C_shape$B2), mean(C_shape$B3), mean(C_shape$B4), mean(C_shape$B5), mean(C_shape$B6), mean(C_shape$B7), mean(C_shape$B8))
mean.D <- c(mean(D_shape$A2), mean(D_shape$A3),mean(D_shape$A4),mean(D_shape$A5),mean(D_shape$A6),mean(D_shape$A7),mean(D_shape$A8), mean(D_shape$B2), mean(D_shape$B3), mean(D_shape$B4), mean(D_shape$B5), mean(D_shape$B6), mean(D_shape$B7), mean(D_shape$B8))
mean.D3 <- c(mean(D3_shape$A2), mean(D3_shape$A3),mean(D3_shape$A4),mean(D3_shape$A5),mean(D3_shape$A6),mean(D3_shape$A7),mean(D3_shape$A8), mean(D3_shape$B2), mean(D3_shape$B3), mean(D3_shape$B4), mean(D3_shape$B5), mean(D3_shape$B6), mean(D3_shape$B7), mean(D3_shape$B8))
mean.E <- c(mean(E_shape$A2), mean(E_shape$A3),mean(E_shape$A4),mean(E_shape$A5),mean(E_shape$A6),mean(E_shape$A7),mean(E_shape$A8), mean(E_shape$B2), mean(E_shape$B3), mean(E_shape$B4), mean(E_shape$B5), mean(E_shape$B6), mean(E_shape$B7), mean(E_shape$B8))
mean.F <- c(mean(F_shape$A2), mean(F_shape$A3),mean(F_shape$A4),mean(F_shape$A5),mean(F_shape$A6),mean(F_shape$A7),mean(F_shape$A8), mean(F_shape$B2), mean(F_shape$B3), mean(F_shape$B4), mean(F_shape$B5), mean(F_shape$B6), mean(F_shape$B7), mean(F_shape$B8))
mean.G <- c(mean(G_shape$A2), mean(G_shape$A3),mean(G_shape$A4),mean(G_shape$A5),mean(G_shape$A6),mean(G_shape$A7),mean(G_shape$A8), mean(G_shape$B2), mean(G_shape$B3), mean(G_shape$B4), mean(G_shape$B5), mean(G_shape$B6), mean(G_shape$B7), mean(G_shape$B8))
mean.M <- c(mean(M_shape$A2), mean(M_shape$A3),mean(M_shape$A4),mean(M_shape$A5),mean(M_shape$A6),mean(M_shape$A7),mean(M_shape$A8), mean(M_shape$B2), mean(M_shape$B3), mean(M_shape$B4), mean(M_shape$B5), mean(M_shape$B6), mean(M_shape$B7), mean(M_shape$B8))
mean.N <- c(mean(N_shape$A2), mean(N_shape$A3),mean(N_shape$A4),mean(N_shape$A5),mean(N_shape$A6),mean(N_shape$A7),mean(N_shape$A8), mean(N_shape$B2), mean(N_shape$B3), mean(N_shape$B4), mean(N_shape$B5), mean(N_shape$B6), mean(N_shape$B7), mean(N_shape$B8))
mean.T <- c(mean(T_shape$A2), mean(T_shape$A3),mean(T_shape$A4),mean(T_shape$A5),mean(T_shape$A6),mean(T_shape$A7),mean(T_shape$A8), mean(T_shape$B2), mean(T_shape$B3), mean(T_shape$B4), mean(T_shape$B5), mean(T_shape$B6), mean(T_shape$B7), mean(T_shape$B8))
mean.X1 <- c(mean(X1_shape$A2), mean(X1_shape$A3),mean(X1_shape$A4),mean(X1_shape$A5),mean(X1_shape$A6),mean(X1_shape$A7),mean(X1_shape$A8), mean(X1_shape$B2), mean(X1_shape$B3), mean(X1_shape$B4), mean(X1_shape$B5), mean(X1_shape$B6), mean(X1_shape$B7), mean(X1_shape$B8))
mean.X10 <- c(mean(X10_shape$A2), mean(X10_shape$A3),mean(X10_shape$A4),mean(X10_shape$A5),mean(X10_shape$A6),mean(X10_shape$A7),mean(X10_shape$A8), mean(X10_shape$B2), mean(X10_shape$B3), mean(X10_shape$B4), mean(X10_shape$B5), mean(X10_shape$B6), mean(X10_shape$B7), mean(X10_shape$B8))
mean.X11 <- c(mean(X11_shape$A2), mean(X11_shape$A3),mean(X11_shape$A4),mean(X11_shape$A5),mean(X11_shape$A6),mean(X11_shape$A7),mean(X11_shape$A8), mean(X11_shape$B2), mean(X11_shape$B3), mean(X11_shape$B4), mean(X11_shape$B5), mean(X11_shape$B6), mean(X11_shape$B7), mean(X11_shape$B8))
mean.C <- as.matrix(mean.C)
mean.D <- as.matrix(mean.D)
mean.D3 <- as.matrix(mean.D3)
mean.E <- as.matrix(mean.E)
mean.F <- as.matrix(mean.F)
mean.G <- as.matrix(mean.G)
mean.M <- as.matrix(mean.M)
mean.N <- as.matrix(mean.N)
mean.T <- as.matrix(mean.T)
mean.X1 <- as.matrix(mean.X1)
mean.X10 <- as.matrix(mean.X10)
mean.X11 <- as.matrix(mean.X11)
### Variance-covariance matrix ###
cov.C <- cov(C_shape[2:15])
cov.D <- cov(D_shape[2:15])
cov.D3 <- cov(D3_shape[2:15])
cov.E <- cov(E_shape[2:15])
cov.F <- cov(F_shape[2:15])
cov.G <- cov(G_shape[2:15])
cov.M <- cov(M_shape[2:15])
cov.N <- cov(N_shape[2:15])
cov.T <- cov(T_shape[2:15])
cov.X1 <- cov(X1_shape[2:15])
cov.X10 <- cov(X10_shape[2:15])
cov.X11 <- cov(X11_shape[2:15])
### sample size ###
n.C <- dim(C_shape) [1]
n.D <- dim(D_shape) [1]
n.D3 <- dim(D3_shape) [1]
n.E <- dim(E_shape) [1]
n.F <- dim(F_shape) [1]
n.G <- dim(G_shape) [1]
n.M <- dim(M_shape) [1]
n.N <- dim(N_shape) [1]
n.T <- dim(T_shape) [1]
n.X1 <- dim(X1_shape) [1]
n.X10 <- dim(X10_shape) [1]
n.X11 <- dim(X11_shape) [1]
cov.df <- n.C+n.D+n.D3+n.E+n.F+n.G+n.M+n.N+n.T+n.X1+n.X10+n.X11-n.class
cov.d <- ((n.C-1)/cov.df)*cov.C+((n.D-1)/cov.df)*cov.D+((n.D3-1)/cov.df)*cov.D3+((n.E-1)/cov.df)*cov.E+((n.F-1)/cov.df)*cov.F+((n.G-1)/cov.df)*cov.G+((n.M-1)/cov.df)*cov.M+((n.N-1)/cov.df)*cov.N+((n.T-1)/cov.df)*cov.T+((n.X1-1)/cov.df)*cov.X1+((n.X10-1)/cov.df)*cov.X10+((n.X11-1)/cov.df)*cov.X11
### determinant
d <- det(cov.d)
### Coefficients of Linear classification function (loadings)
cj.C <- solve(cov.d)%*%mean.C
cj.D <- solve(cov.d)%*%mean.D
cj.D3 <- solve(cov.d)%*%mean.D3
cj.E <- solve(cov.d)%*%mean.E
cj.F <- solve(cov.d)%*%mean.F
cj.G <- solve(cov.d)%*%mean.G
cj.M <- solve(cov.d)%*%mean.M
cj.N <- solve(cov.d)%*%mean.N
cj.T <- solve(cov.d)%*%mean.T
cj.X1 <- solve(cov.d)%*%mean.X1
cj.X10 <- solve(cov.d)%*%mean.X10
cj.X11 <- solve(cov.d)%*%mean.X11
### Intercepts
cj0.C <- -.5*t(cj.C)%*%mean.C
cj0.D <- -.5*t(cj.D)%*%mean.D
cj0.D3 <- -.5*t(cj.D3)%*%mean.D3
cj0.E <- -.5*t(cj.E)%*%mean.E
cj0.F <- -.5*t(cj.F)%*%mean.F
cj0.G <- -.5*t(cj.G)%*%mean.G
cj0.M <- -.5*t(cj.M)%*%mean.M
cj0.N <- -.5*t(cj.N)%*%mean.N
cj0.T <- -.5*t(cj.T)%*%mean.T
cj0.X1 <- -.5*t(cj.X1)%*%mean.X1
cj0.X10 <- -.5*t(cj.X10)%*%mean.X10
cj0.X11 <- -.5*t(cj.X11)%*%mean.X11
### Typicality probabilities ###
typicality <- matrix(NA, N, n.class)
colnames(typicality) <- c("typC","typD","typD3","typE","typF","typG","typM","typN","typT","typX1","typX10","typX11")
for(q in 1:N) {
case <- matrix(NA,12,1)
case <- c(All[q,2],All[q,3],All[q,4],All[q,5],All[q,6],All[q,7],All[q,8],All[q,9],All[q,10],All[q,11],All[q,12],All[q,13],All[q,14],All[q,15])
d2.C <- (t(case-mean.C))%*%solve(cov.d)%*%(case-mean.C)
typicality[q,1] <- pchisq(d2.C, df = 14, lower.tail = FALSE)
d2.D <- (t(case-mean.D))%*%solve(cov.d)%*%(case-mean.D)
typicality[q,2] <- pchisq(d2.D, df = 14, lower.tail = FALSE)
d2.D3 <- (t(case-mean.D3))%*%solve(cov.d)%*%(case-mean.D3)
typicality[q,3] <- pchisq(d2.D3, df = 14, lower.tail = FALSE)
d2.E <- (t(case-mean.E))%*%solve(cov.d)%*%(case-mean.E)
typicality[q,4] <- pchisq(d2.E, df = 14, lower.tail = FALSE)
d2.F <- (t(case-mean.F))%*%solve(cov.d)%*%(case-mean.F)
typicality[q,5] <- pchisq(d2.F, df = 14, lower.tail = FALSE)
d2.G <- (t(case-mean.G))%*%solve(cov.d)%*%(case-mean.G)
typicality[q,6] <- pchisq(d2.G, df = 14, lower.tail = FALSE)
d2.M <- (t(case-mean.M))%*%solve(cov.d)%*%(case-mean.M)
typicality[q,7] <- pchisq(d2.M, df = 14, lower.tail = FALSE)
d2.N <- (t(case-mean.N))%*%solve(cov.d)%*%(case-mean.N)
typicality[q,8] <- pchisq(d2.N, df = 14, lower.tail = FALSE)
d2.T <- (t(case-mean.T))%*%solve(cov.d)%*%(case-mean.T)
typicality[q,9] <- pchisq(d2.T, df = 14, lower.tail = FALSE)
d2.X1 <- (t(case-mean.X1))%*%solve(cov.d)%*%(case-mean.X1)
typicality[q,10] <- pchisq(d2.X1, df = 14, lower.tail = FALSE)
d2.X10 <- (t(case-mean.X10))%*%solve(cov.d)%*%(case-mean.X10)
typicality[q,11] <- pchisq(d2.X10, df = 14, lower.tail = FALSE)
d2.X11 <- (t(case-mean.X11))%*%solve(cov.d)%*%(case-mean.X11)
typicality[q,12] <- pchisq(d2.X11, df = 14, lower.tail = FALSE)
}
typicality <- round(typicality, digits=2)
typicality <- cbind(All[ ,c(1,17:18)], typicality)
typicality
## collection Species2 Sex typC typD typD3 typE typF typG typM typN typT typX1 typX10 typX11
## 8 82575 C F 0.69 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
## 9 82576 C M 0.22 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
## 12 89647 C M 0.11 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
## 86 91283 C F_eggs 0.11 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
## 87 91284 C M 0.46 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
## 88 91287 C M 0.19 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
## 89 91290 C M 0.30 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.04
## 90 91291 C M 0.51 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.02
## 91 91293 C M 0.25 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
## 92 91295 C M 0.80 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
## 93 91298 C M 0.06 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
## 94 91300 C F 0.05 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
## 95 91302 C M 0.04 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
## 96 91304 C F 0.40 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
## 97 91305 C F 0.07 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
## 98 91306 C F 0.13 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
## 99 91308 C M 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
## 100 91314 C M 0.40 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.02
## 101 91315 C M 0.08 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
## 102 91317 C F 0.62 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
## 103 91318 C F 0.37 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
## 104 91319 C M 0.58 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
## 105 91320 C M 0.77 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.01
## 106 91322 C M 0.70 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
## 107 91323 C M 0.07 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
## 108 91325 C F 0.41 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
## 109 91326 C F 0.30 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
## 110 91327 C F 0.79 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
## 111 91328 C F 0.51 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
## 112 91329 C M 0.95 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
## 113 91330 C F 0.86 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
## 114 91331 C M 0.90 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
## 115 91332 C F 0.13 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
## 116 91333 C M 0.03 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
## 117 91334 C F 0.19 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
## 118 91336 C F 0.01 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
## 119 91337 C M 0.04 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
## 120 91338 C F 0.64 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
## 121 91339 C F 0.60 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
## 122 91340 C F 0.73 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
## 123 91341 C M 0.77 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
## 124 91342 C M 0.26 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
## 125 91343 C M 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.01
## 126 91344 C F 0.83 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
## 127 91345 C M 0.63 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
## 128 91347 C M 0.05 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
## 129 91349 C F 0.27 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
## 130 91350 C F 0.62 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
## 131 91351 C M 0.02 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
## 132 91352 C F 0.34 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
## 133 91353 C M 0.01 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
## 134 91354 C F 0.26 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
## 135 91355 C M 0.46 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
## 136 91356 C F 0.06 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
## 137 91357 C M 0.08 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
## 138 91358 C F 0.33 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
## 139 91359 C F 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
## 140 91360 C F 0.07 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
## 141 91361 C M 0.70 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.01
## 142 91362 C M 0.25 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
## 143 91363 C F 0.44 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.01
## 144 91365 C F 0.34 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
## 145 91366 C M 0.13 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
## 146 91367 C M 0.17 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
## 147 91368 C F 0.81 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
## 148 91369 C M 0.32 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
## 149 91370 C M 0.04 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.01 0.00 0.00
## 150 91371 C F 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
## 151 91372 C F 0.80 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
## 152 91373 C M 0.06 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
## 153 91374 C F 0.21 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
## 154 91375 C F 0.57 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
## 155 91376 C F 0.93 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
## 156 91379 D F_eggs 0.00 0.05 0.10 0.00 0.00 0.01 0.00 0.01 0.00 0.00 0.00 0.00
## 157 91380 D M 0.00 0.45 0.30 0.00 0.13 0.00 0.00 0.01 0.00 0.81 0.00 0.00
## 160 91383 D F_eggs 0.00 0.60 0.55 0.00 0.00 0.05 0.10 0.41 0.00 0.01 0.00 0.00
## 161 91384 D F_eggs 0.00 0.47 0.19 0.00 0.00 0.00 0.00 0.15 0.00 0.10 0.00 0.00
## 162 91385 D F 0.00 0.44 0.09 0.00 0.00 0.00 0.11 0.60 0.00 0.02 0.00 0.00
## 163 91386 D M 0.00 0.08 0.00 0.00 0.45 0.00 0.00 0.01 0.00 0.28 0.00 0.00
## 164 91387 D M 0.00 0.96 0.47 0.00 0.06 0.01 0.00 0.19 0.00 0.79 0.00 0.00
## 165 91389 D F_eggs 0.00 0.85 0.85 0.00 0.01 0.00 0.00 0.43 0.00 0.20 0.00 0.00
## 166 91390 D F 0.00 0.08 0.02 0.00 0.00 0.01 0.00 0.00 0.00 0.00 0.00 0.00
## 167 91391 D F 0.00 0.48 0.25 0.00 0.02 0.00 0.00 0.23 0.00 0.09 0.00 0.00
## 168 91392 D M 0.00 0.13 0.04 0.00 0.00 0.00 0.00 0.08 0.00 0.01 0.00 0.00
## 169 91393 D F_eggs 0.00 0.92 0.74 0.00 0.00 0.13 0.00 0.49 0.00 0.35 0.00 0.00
## 170 91394 D M 0.00 0.64 0.64 0.00 0.07 0.00 0.00 0.01 0.00 0.33 0.00 0.00
## 171 91395 D M 0.00 0.91 0.76 0.00 0.11 0.00 0.00 0.31 0.00 0.57 0.00 0.00
## 172 91396 D F 0.00 0.89 0.62 0.00 0.04 0.01 0.00 0.03 0.00 0.46 0.00 0.00
## 173 91397 D F 0.00 0.19 0.00 0.00 0.00 0.00 0.03 0.16 0.00 0.02 0.00 0.00
## 174 91398 D M 0.00 0.01 0.00 0.00 0.00 0.01 0.00 0.00 0.00 0.00 0.00 0.00
## 175 91401 D F 0.00 0.23 0.31 0.00 0.00 0.00 0.00 0.00 0.00 0.03 0.00 0.00
## 176 91402 D F 0.00 0.66 0.21 0.00 0.02 0.00 0.00 0.20 0.00 0.06 0.00 0.00
## 177 91403 D M 0.00 0.14 0.00 0.00 0.01 0.00 0.00 0.00 0.00 0.02 0.00 0.00
## 178 91404 D M 0.00 0.82 0.15 0.00 0.09 0.00 0.01 0.39 0.00 0.14 0.00 0.00
## 182 91410 D M 0.00 0.95 0.73 0.00 0.05 0.00 0.00 0.09 0.00 0.56 0.00 0.00
## 183 91411 D M 0.00 0.51 0.11 0.00 0.03 0.00 0.00 0.00 0.00 0.29 0.00 0.00
## 184 91412 D F 0.00 0.95 0.77 0.00 0.01 0.06 0.08 0.85 0.00 0.10 0.00 0.00
## 185 91413 D M 0.00 0.18 0.28 0.00 0.00 0.00 0.00 0.00 0.00 0.03 0.00 0.00
## 186 91414 D F 0.00 0.92 0.42 0.00 0.02 0.00 0.00 0.50 0.00 0.57 0.00 0.00
## 187 91415 D F 0.00 0.24 0.18 0.00 0.00 0.01 0.00 0.03 0.00 0.33 0.00 0.00
## 188 91416 D M 0.00 0.70 0.42 0.00 0.32 0.00 0.00 0.01 0.00 0.52 0.00 0.00
## 189 91417 D F 0.00 0.69 0.39 0.00 0.15 0.00 0.00 0.03 0.00 0.49 0.00 0.00
## 190 91418 D F 0.00 0.92 0.42 0.00 0.02 0.00 0.00 0.38 0.00 0.55 0.00 0.00
## 191 91419 D F 0.00 0.84 0.44 0.00 0.04 0.00 0.00 0.14 0.00 0.20 0.00 0.00
## 158 91381 D3 F 0.00 0.34 0.79 0.00 0.00 0.01 0.00 0.21 0.00 0.03 0.00 0.00
## 159 91382 D3 M 0.00 0.00 0.12 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
## 179 91407 D3 M 0.00 0.96 0.99 0.00 0.01 0.09 0.00 0.37 0.00 0.13 0.00 0.00
## 180 91408 D3 M 0.00 0.46 0.84 0.00 0.00 0.33 0.00 0.19 0.00 0.00 0.00 0.00
## 181 91409 D3 M 0.00 0.76 0.59 0.00 0.02 0.00 0.00 0.05 0.00 0.20 0.00 0.00
## 192 91420 E M 0.00 0.00 0.00 0.89 0.00 0.00 0.15 0.00 0.00 0.00 0.00 0.00
## 193 91421 E F_eggs 0.00 0.00 0.00 0.90 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
## 194 91422 E F_eggs 0.00 0.00 0.00 0.81 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
## 195 91423 E F_eggs 0.00 0.00 0.00 0.58 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
## 196 91424 E F 0.00 0.00 0.00 0.94 0.00 0.00 0.12 0.00 0.00 0.00 0.00 0.00
## 197 91425 E F 0.00 0.00 0.00 0.93 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
## 198 91426 E M 0.00 0.00 0.00 0.85 0.00 0.01 0.00 0.00 0.00 0.00 0.00 0.00
## 199 91427 E M 0.00 0.00 0.00 0.98 0.00 0.00 0.00 0.00 0.00 0.00 0.01 0.00
## 200 91428 E F 0.00 0.00 0.00 0.46 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
## 201 91429 E F 0.00 0.00 0.00 0.80 0.00 0.00 0.00 0.00 0.00 0.00 0.07 0.00
## 202 91430 E M 0.00 0.00 0.00 0.64 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
## 203 91431 F M 0.00 0.01 0.00 0.00 0.24 0.00 0.00 0.00 0.00 0.02 0.00 0.00
## 204 91432 F M 0.00 0.01 0.00 0.00 0.40 0.00 0.00 0.00 0.00 0.08 0.00 0.00
## 205 91433 F M 0.00 0.00 0.00 0.00 0.43 0.00 0.00 0.00 0.00 0.09 0.00 0.00
## 206 91434 F M 0.00 0.00 0.00 0.00 0.18 0.00 0.00 0.00 0.00 0.00 0.00 0.00
## 207 91435 F M 0.00 0.00 0.00 0.00 0.04 0.00 0.00 0.00 0.00 0.00 0.00 0.00
## 208 91527 G F 0.00 0.00 0.00 0.00 0.00 0.91 0.01 0.16 0.00 0.00 0.00 0.00
## 209 91528 G F 0.00 0.00 0.00 0.00 0.00 0.94 0.00 0.00 0.00 0.00 0.00 0.00
## 210 91529 G M 0.00 0.01 0.12 0.00 0.00 0.94 0.00 0.01 0.00 0.00 0.00 0.00
## 211 91530 G M 0.00 0.00 0.02 0.00 0.00 0.54 0.00 0.03 0.00 0.00 0.00 0.00
## 212 91531 G M 0.00 0.02 0.01 0.00 0.00 0.87 0.00 0.01 0.00 0.00 0.00 0.00
## 6 82573 M F 0.00 0.00 0.00 0.00 0.00 0.00 0.99 0.25 0.00 0.00 0.00 0.00
## 7 82574 M M 0.00 0.01 0.00 0.00 0.00 0.00 0.90 0.60 0.00 0.00 0.00 0.00
## 13 91147 M F 0.00 0.00 0.00 0.00 0.00 0.00 0.11 0.00 0.00 0.00 0.00 0.00
## 14 91148 M F 0.00 0.05 0.00 0.00 0.00 0.01 0.55 0.89 0.00 0.00 0.00 0.00
## 15 91149 M M 0.00 0.00 0.00 0.00 0.00 0.00 0.27 0.07 0.00 0.00 0.00 0.00
## 16 91150 M M 0.00 0.00 0.00 0.00 0.00 0.00 0.24 0.00 0.00 0.00 0.00 0.00
## 17 91154 M M 0.00 0.00 0.00 0.00 0.00 0.00 0.22 0.04 0.00 0.00 0.00 0.00
## 18 91155 M M 0.00 0.00 0.00 0.00 0.00 0.00 0.22 0.00 0.00 0.00 0.00 0.00
## 19 91156 M F_eggs 0.00 0.00 0.00 0.00 0.00 0.00 0.47 0.00 0.00 0.00 0.00 0.00
## 20 91157 M M 0.00 0.04 0.01 0.00 0.00 0.00 0.72 0.32 0.00 0.00 0.00 0.00
## 21 91158 M M 0.00 0.01 0.00 0.01 0.00 0.01 0.99 0.77 0.00 0.00 0.00 0.00
## 22 91159 M M 0.00 0.00 0.00 0.00 0.00 0.00 0.96 0.26 0.00 0.00 0.00 0.00
## 23 91163 M F_eggs 0.00 0.00 0.00 0.00 0.00 0.00 0.57 0.53 0.00 0.00 0.00 0.00
## 24 91164 M F_eggs 0.00 0.00 0.00 0.00 0.00 0.00 0.93 0.24 0.00 0.00 0.00 0.00
## 25 91165 M M 0.00 0.00 0.00 0.00 0.00 0.00 0.94 0.20 0.00 0.00 0.00 0.00
## 26 91166 M F_eggs 0.00 0.00 0.00 0.00 0.00 0.00 0.51 0.01 0.00 0.00 0.00 0.00
## 27 91167 M F 0.00 0.00 0.00 0.01 0.00 0.00 0.75 0.02 0.00 0.00 0.00 0.00
## 28 91168 M F_eggs 0.00 0.00 0.00 0.02 0.00 0.00 0.99 0.59 0.00 0.00 0.00 0.00
## 29 91169 M M 0.00 0.00 0.00 0.00 0.00 0.00 0.63 0.05 0.00 0.00 0.00 0.00
## 30 91170 M F 0.00 0.00 0.00 0.00 0.00 0.00 0.93 0.35 0.00 0.00 0.00 0.00
## 31 91171 M M 0.00 0.00 0.00 0.00 0.00 0.00 0.97 0.37 0.00 0.00 0.00 0.00
## 32 91172 M F 0.00 0.00 0.00 0.22 0.00 0.00 0.94 0.03 0.00 0.00 0.00 0.00
## 33 91173 M F 0.00 0.00 0.00 0.00 0.00 0.00 0.93 0.03 0.00 0.00 0.00 0.00
## 35 91175 M M 0.00 0.00 0.00 0.00 0.00 0.00 0.76 0.38 0.00 0.00 0.00 0.00
## 36 91176 M F 0.00 0.00 0.00 0.01 0.00 0.00 0.82 0.01 0.00 0.00 0.00 0.00
## 37 91177 M F 0.00 0.00 0.00 0.15 0.00 0.00 0.36 0.00 0.00 0.00 0.00 0.00
## 38 91178 M M 0.00 0.00 0.00 0.00 0.00 0.00 0.61 0.03 0.00 0.00 0.00 0.00
## 39 91179 M M 0.00 0.00 0.00 0.02 0.00 0.00 0.96 0.07 0.00 0.00 0.00 0.00
## 40 91180 M M 0.00 0.00 0.00 0.00 0.00 0.00 0.18 0.00 0.00 0.00 0.00 0.00
## 4 82401 N M 0.00 0.24 0.05 0.00 0.00 0.08 0.33 0.85 0.00 0.01 0.00 0.00
## 5 82534 N M 0.00 0.27 0.22 0.00 0.00 0.03 0.00 0.37 0.00 0.08 0.00 0.00
## 10 82577 N F 0.00 0.02 0.01 0.00 0.00 0.00 0.04 0.79 0.00 0.00 0.00 0.00
## 11 82578 N M 0.00 0.11 0.05 0.00 0.00 0.00 0.03 0.68 0.00 0.02 0.00 0.00
## 41 91182 N M 0.00 0.95 0.69 0.00 0.03 0.02 0.00 0.48 0.00 0.59 0.00 0.00
## 42 91186 N F 0.00 0.02 0.04 0.00 0.00 0.01 0.05 0.82 0.00 0.00 0.00 0.00
## 43 91187 N F 0.00 0.47 0.22 0.00 0.00 0.00 0.01 0.85 0.00 0.38 0.00 0.00
## 44 91188 N F 0.00 0.00 0.00 0.00 0.00 0.00 0.04 0.15 0.00 0.00 0.00 0.00
## 45 91189 N M 0.00 0.02 0.00 0.00 0.00 0.00 0.13 0.49 0.00 0.00 0.00 0.00
## 46 91190 N F 0.00 0.03 0.01 0.00 0.00 0.02 0.27 0.78 0.00 0.00 0.00 0.00
## 47 91191 N M 0.00 0.17 0.17 0.00 0.00 0.00 0.00 0.21 0.00 0.04 0.00 0.00
## 48 91204 N M 0.00 0.96 0.42 0.00 0.02 0.00 0.01 0.59 0.00 0.87 0.00 0.00
## 49 91205 N M 0.00 0.30 0.11 0.00 0.00 0.00 0.11 0.91 0.00 0.04 0.00 0.00
## 50 91206 N F 0.00 0.00 0.00 0.15 0.00 0.00 0.65 0.13 0.00 0.00 0.00 0.00
## 51 91207 N M 0.00 0.60 0.33 0.00 0.00 0.64 0.11 0.80 0.00 0.02 0.00 0.00
## 52 91208 N M 0.00 0.63 0.36 0.00 0.00 0.03 0.01 0.50 0.00 0.12 0.00 0.00
## 53 91209 N F_eggs 0.00 0.20 0.02 0.00 0.00 0.00 0.02 0.43 0.00 0.02 0.00 0.00
## 54 91210 N F 0.00 0.64 0.52 0.00 0.00 0.03 0.25 0.84 0.00 0.06 0.00 0.00
## 55 91211 N M 0.00 0.02 0.00 0.00 0.00 0.00 0.00 0.21 0.00 0.00 0.00 0.00
## 56 91212 N F 0.00 0.00 0.00 0.00 0.00 0.00 0.05 0.47 0.00 0.00 0.00 0.00
## 57 91213 N M 0.00 0.16 0.09 0.00 0.00 0.09 0.42 0.89 0.00 0.00 0.00 0.00
## 58 91214 N F_eggs 0.00 0.00 0.00 0.00 0.00 0.00 0.36 0.29 0.00 0.00 0.00 0.00
## 59 91215 N F_eggs 0.00 0.00 0.00 0.00 0.00 0.00 0.01 0.08 0.00 0.00 0.00 0.00
## 60 91221 N F 0.00 0.10 0.01 0.00 0.00 0.05 0.35 0.97 0.00 0.01 0.00 0.00
## 61 91222 N M 0.00 0.20 0.03 0.00 0.00 0.12 0.12 0.92 0.00 0.02 0.00 0.00
## 62 91223 N M 0.00 0.33 0.02 0.00 0.00 0.00 0.38 0.85 0.00 0.02 0.00 0.00
## 63 91224 N M 0.00 0.38 0.24 0.00 0.00 0.34 0.09 0.95 0.00 0.01 0.00 0.00
## 64 91225 N F 0.00 0.27 0.10 0.00 0.00 0.00 0.23 0.70 0.00 0.00 0.00 0.00
## 65 91226 N M 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.05 0.00 0.00 0.00 0.00
## 66 91227 N F 0.00 0.02 0.02 0.03 0.00 0.09 0.61 0.62 0.00 0.00 0.00 0.00
## 67 91228 N F 0.00 0.03 0.03 0.00 0.00 0.02 0.00 0.47 0.00 0.01 0.00 0.00
## 68 91229 N F 0.00 0.03 0.00 0.00 0.00 0.01 0.06 0.63 0.00 0.01 0.00 0.00
## 69 91230 N M 0.00 0.06 0.01 0.00 0.00 0.00 0.01 0.68 0.00 0.01 0.00 0.00
## 70 91231 N M 0.00 0.06 0.00 0.00 0.00 0.00 0.01 0.56 0.00 0.00 0.00 0.00
## 71 91232 N M 0.00 0.68 0.32 0.00 0.00 0.01 0.01 0.87 0.00 0.06 0.00 0.00
## 72 91233 N M 0.00 0.69 0.21 0.00 0.01 0.00 0.01 0.85 0.00 0.46 0.00 0.00
## 73 91234 N M 0.00 0.08 0.06 0.00 0.00 0.05 0.04 0.68 0.00 0.00 0.00 0.00
## 74 91235 N F 0.00 0.10 0.04 0.00 0.00 0.01 0.15 0.90 0.00 0.00 0.00 0.00
## 75 91236 N F_eggs 0.00 0.02 0.00 0.00 0.00 0.04 0.06 0.80 0.00 0.00 0.00 0.00
## 76 91237 N M 0.00 0.42 0.08 0.00 0.00 0.04 0.00 0.62 0.00 0.01 0.00 0.00
## 77 91239 N M 0.00 0.39 0.07 0.00 0.00 0.02 0.12 0.75 0.00 0.08 0.00 0.00
## 78 91240 N M 0.00 0.81 0.42 0.00 0.01 0.10 0.12 0.83 0.00 0.20 0.00 0.00
## 79 91241 N M 0.00 0.25 0.06 0.00 0.00 0.06 0.08 0.75 0.00 0.00 0.00 0.00
## 80 91242 N F 0.00 0.05 0.02 0.00 0.00 0.06 0.09 0.95 0.00 0.00 0.00 0.00
## 81 91243 N F 0.00 0.03 0.00 0.00 0.00 0.00 0.25 0.88 0.00 0.00 0.00 0.00
## 82 91244 N F 0.00 0.00 0.00 0.00 0.00 0.00 0.68 0.54 0.00 0.00 0.00 0.00
## 83 91245 N F 0.00 0.01 0.00 0.00 0.00 0.00 0.09 0.62 0.00 0.00 0.00 0.00
## 84 91246 N F 0.00 0.13 0.02 0.00 0.00 0.01 0.33 0.93 0.00 0.00 0.00 0.00
## 85 91247 N F 0.00 0.60 0.43 0.00 0.00 0.20 0.33 0.99 0.00 0.02 0.00 0.00
## 225 Cae727 T F 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.66 0.00 0.00 0.00
## 226 Cae728 T M 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.76 0.00 0.00 0.00
## 228 Cae730 T M 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.70 0.00 0.00 0.00
## 220 Cae722 X1 M 0.00 0.64 0.22 0.00 0.21 0.00 0.00 0.00 0.00 0.97 0.00 0.00
## 221 Cae723 X1 M 0.00 0.02 0.00 0.00 0.32 0.00 0.00 0.00 0.00 0.66 0.00 0.00
## 222 Cae724 X1 M 0.00 0.15 0.02 0.00 0.02 0.00 0.00 0.00 0.00 0.86 0.00 0.00
## 223 Cae725 X1 F_eggs 0.00 0.25 0.07 0.00 0.08 0.00 0.00 0.02 0.00 0.80 0.00 0.00
## 224 Cae726 X1 F_eggs 0.00 0.37 0.03 0.00 0.01 0.00 0.00 0.02 0.00 0.86 0.00 0.00
## 227 Cae729 X1 F 0.00 0.15 0.00 0.00 0.01 0.00 0.00 0.04 0.00 0.67 0.00 0.00
## 229 Cae743 X1 M 0.00 0.61 0.22 0.00 0.21 0.00 0.00 0.01 0.00 0.90 0.00 0.00
## 230 Cae746 X1 M 0.00 0.42 0.02 0.00 0.21 0.00 0.00 0.01 0.00 0.95 0.00 0.00
## 231 Cae748 X1 M 0.00 0.16 0.01 0.00 0.02 0.00 0.00 0.00 0.00 0.92 0.00 0.00
## 232 Cae755 X1 M 0.00 0.65 0.38 0.00 0.70 0.00 0.00 0.01 0.00 0.89 0.00 0.00
## 233 Cae756 X1 M 0.00 0.26 0.01 0.00 0.03 0.00 0.00 0.05 0.00 0.74 0.00 0.00
## 234 Cae757 X1 M 0.00 0.87 0.31 0.00 0.13 0.00 0.00 0.14 0.00 1.00 0.00 0.00
## 235 Cae758 X1 M 0.00 0.36 0.01 0.00 0.48 0.00 0.00 0.00 0.00 0.44 0.00 0.00
## 236 Cae759 X1 F_eggs 0.00 0.40 0.10 0.00 0.00 0.00 0.00 0.02 0.00 0.56 0.00 0.00
## 216 Cae718 X10 M 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.47 0.00
## 217 Cae719 X10 M 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.98 0.00
## 218 Cae720 X10 M 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.01 0.00 0.98 0.00
## 219 Cae721 X10 M 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.85 0.00
## 237 Cae770 X11 M 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.91
## 238 Cae771 X11 F_eggs 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.53
## 239 Cae772 X11 M 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.77
## 240 Cae773 X11 F 0.02 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.73
### 9 Classify specimen to species
lutraria <- shape_8[248, c(2:15)] #new specimen to classify
lutraria <- as.matrix(lutraria)
# get classification score
p.C <- lutraria%*%cj.C+cj0.C+log(All.lda$prior[1])
p.D <- lutraria%*%cj.D+cj0.D+log(All.lda$prior[2])
p.D3 <- lutraria%*%cj.D3+cj0.D3+log(All.lda$prior[3])
p.E <- lutraria%*%cj.E+cj0.E+log(All.lda$prior[4])
p.F <- lutraria%*%cj.F+cj0.F+log(All.lda$prior[5])
p.G <- lutraria%*%cj.G+cj0.G+log(All.lda$prior[6])
p.M <- lutraria%*%cj.M+cj0.M+log(All.lda$prior[7])
p.N <- lutraria%*%cj.N+cj0.N+log(All.lda$prior[8])
p.T <- lutraria%*%cj.T+cj0.T+log(All.lda$prior[9])
p.X1 <- lutraria%*%cj.X1+cj0.X1+log(All.lda$prior[10])
p.X10 <- lutraria%*%cj.X10+cj0.X10+log(All.lda$prior[11])
p.X11 <- lutraria%*%cj.X11+cj0.X11+log(All.lda$prior[12])
# posterior probability
post.C <- (exp(p.C-p.C))/(exp(p.D-p.C)+exp(p.C-p.C)+exp(p.D3-p.C)+exp(p.E-p.C)+exp(p.F-p.C)+exp(p.G-p.C)+exp(p.M-p.C)+exp(p.N-p.C)+exp(p.T-p.C)+exp(p.X1-p.C)+exp(p.X10-p.C)+exp(p.X11-p.C))
post.D <- (exp(p.D-p.C))/(exp(p.D-p.C)+exp(p.C-p.C)+exp(p.D3-p.C)+exp(p.E-p.C)+exp(p.F-p.C)+exp(p.G-p.C)+exp(p.M-p.C)+exp(p.N-p.C)+exp(p.T-p.C)+exp(p.X1-p.C)+exp(p.X10-p.C)+exp(p.X11-p.C))
post.D3 <- (exp(p.D3-p.C))/(exp(p.D-p.C)+exp(p.C-p.C)+exp(p.D3-p.C)+exp(p.E-p.C)+exp(p.F-p.C)+exp(p.G-p.C)+exp(p.M-p.C)+exp(p.N-p.C)+exp(p.T-p.C)+exp(p.X1-p.C)+exp(p.X10-p.C)+exp(p.X11-p.C))
post.E <- (exp(p.E-p.C))/(exp(p.D-p.C)+exp(p.C-p.C)+exp(p.D3-p.C)+exp(p.E-p.C)+exp(p.F-p.C)+exp(p.G-p.C)+exp(p.M-p.C)+exp(p.N-p.C)+exp(p.T-p.C)+exp(p.X1-p.C)+exp(p.X10-p.C)+exp(p.X11-p.C))
post.F <- (exp(p.F-p.C))/(exp(p.D-p.C)+exp(p.C-p.C)+exp(p.D3-p.C)+exp(p.E-p.C)+exp(p.F-p.C)+exp(p.G-p.C)+exp(p.M-p.C)+exp(p.N-p.C)+exp(p.T-p.C)+exp(p.X1-p.C)+exp(p.X10-p.C)+exp(p.X11-p.C))
post.G <- (exp(p.G-p.C))/(exp(p.D-p.C)+exp(p.C-p.C)+exp(p.D3-p.C)+exp(p.E-p.C)+exp(p.F-p.C)+exp(p.G-p.C)+exp(p.M-p.C)+exp(p.N-p.C)+exp(p.T-p.C)+exp(p.X1-p.C)+exp(p.X10-p.C)+exp(p.X11-p.C))
post.M <- (exp(p.M-p.C))/(exp(p.D-p.C)+exp(p.C-p.C)+exp(p.D3-p.C)+exp(p.E-p.C)+exp(p.F-p.C)+exp(p.G-p.C)+exp(p.M-p.C)+exp(p.N-p.C)+exp(p.T-p.C)+exp(p.X1-p.C)+exp(p.X10-p.C)+exp(p.X11-p.C))
post.N <- (exp(p.N-p.C))/(exp(p.D-p.C)+exp(p.C-p.C)+exp(p.D3-p.C)+exp(p.E-p.C)+exp(p.F-p.C)+exp(p.G-p.C)+exp(p.M-p.C)+exp(p.N-p.C)+exp(p.T-p.C)+exp(p.X1-p.C)+exp(p.X10-p.C)+exp(p.X11-p.C))
post.T <- (exp(p.T-p.C))/(exp(p.D-p.C)+exp(p.C-p.C)+exp(p.D3-p.C)+exp(p.E-p.C)+exp(p.F-p.C)+exp(p.G-p.C)+exp(p.M-p.C)+exp(p.N-p.C)+exp(p.T-p.C)+exp(p.X1-p.C)+exp(p.X10-p.C)+exp(p.X11-p.C))
post.X1 <- (exp(p.X1-p.C))/(exp(p.D-p.C)+exp(p.C-p.C)+exp(p.D3-p.C)+exp(p.E-p.C)+exp(p.F-p.C)+exp(p.G-p.C)+exp(p.M-p.C)+exp(p.N-p.C)+exp(p.T-p.C)+exp(p.X1-p.C)+exp(p.X10-p.C)+exp(p.X11-p.C))
post.X10 <- (exp(p.X10-p.C))/(exp(p.D-p.C)+exp(p.C-p.C)+exp(p.D3-p.C)+exp(p.E-p.C)+exp(p.F-p.C)+exp(p.G-p.C)+exp(p.M-p.C)+exp(p.N-p.C)+exp(p.T-p.C)+exp(p.X1-p.C)+exp(p.X10-p.C)+exp(p.X11-p.C))
post.X11 <- (exp(p.X11-p.C))/(exp(p.D-p.C)+exp(p.C-p.C)+exp(p.D3-p.C)+exp(p.E-p.C)+exp(p.F-p.C)+exp(p.G-p.C)+exp(p.M-p.C)+exp(p.N-p.C)+exp(p.T-p.C)+exp(p.X1-p.C)+exp(p.X10-p.C)+exp(p.X11-p.C))
lutraria.posteriors <- as.matrix(c(post.C, post.D, post.D3, post.E, post.F, post.G, post.M, post.N, post.T, post.X1, post.X10, post.X11))
rownames(lutraria.posteriors) <- c("C", "D", "D3", "E", "F", "G", "M", "N", "T", "X1", "X10", "X11")
colnames(lutraria.posteriors) <- "lutraria.posteriors"
lutraria.posteriors <- round(lutraria.posteriors, digits=3)
lutraria.posteriors
## lutraria.posteriors
## C 0.442
## D 0.005
## D3 0.331
## E 0.000
## F 0.150
## G 0.000
## M 0.000
## N 0.000
## T 0.000
## X1 0.072
## X10 0.000
## X11 0.000
#typicality probability
d2.C <- (t(as.vector(lutraria)-mean.C))%*%solve(cov.d)%*%(as.vector(lutraria)-mean.C)
typicality.C <- pchisq(d2.C, df = 14, lower.tail = FALSE)
d2.D <- (t(as.vector(lutraria)-mean.D))%*%solve(cov.d)%*%(as.vector(lutraria)-mean.D)
typicality.D <- pchisq(d2.D, df = 14, lower.tail = FALSE)
d2.D3 <- (t(as.vector(lutraria)-mean.D3))%*%solve(cov.d)%*%(as.vector(lutraria)-mean.D3)
typicality.D3 <- pchisq(d2.D3, df = 14, lower.tail = FALSE)
d2.E <- (t(as.vector(lutraria)-mean.E))%*%solve(cov.d)%*%(as.vector(lutraria)-mean.E)
typicality.E <- pchisq(d2.E, df = 14, lower.tail = FALSE)
d2.F <- (t(as.vector(lutraria)-mean.F))%*%solve(cov.d)%*%(as.vector(lutraria)-mean.F)
typicality.F <- pchisq(d2.F, df = 14, lower.tail = FALSE)
d2.G <- (t(as.vector(lutraria)-mean.G))%*%solve(cov.d)%*%(as.vector(lutraria)-mean.G)
typicality.G <- pchisq(d2.G, df = 14, lower.tail = FALSE)
d2.M <- (t(as.vector(lutraria)-mean.M))%*%solve(cov.d)%*%(as.vector(lutraria)-mean.M)
typicality.M <- pchisq(d2.M, df = 14, lower.tail = FALSE)
d2.N <- (t(as.vector(lutraria)-mean.N))%*%solve(cov.d)%*%(as.vector(lutraria)-mean.N)
typicality.N <- pchisq(d2.N, df = 14, lower.tail = FALSE)
d2.T <- (t(as.vector(lutraria)-mean.T))%*%solve(cov.d)%*%(as.vector(lutraria)-mean.T)
typicality.T <- pchisq(d2.T, df = 14, lower.tail = FALSE)
d2.X1 <- (t(as.vector(lutraria)-mean.X1))%*%solve(cov.d)%*%(as.vector(lutraria)-mean.X1)
typicality.X1 <- pchisq(d2.X1, df = 14, lower.tail = FALSE)
d2.X10 <- (t(as.vector(lutraria)-mean.X10))%*%solve(cov.d)%*%(as.vector(lutraria)-mean.X10)
typicality.X10 <- pchisq(d2.X10, df = 14, lower.tail = FALSE)
d2.X11 <- (t(as.vector(lutraria)-mean.X11))%*%solve(cov.d)%*%(as.vector(lutraria)-mean.X11)
typicality.X11 <- pchisq(d2.X11, df = 14, lower.tail = FALSE)
lutraria.typicality <- as.matrix(c(typicality.C, typicality.D, typicality.D3, typicality.E, typicality.F, typicality.G, typicality.M, typicality.N, typicality.T, typicality.X1, typicality.X10, typicality.X11))
rownames(lutraria.typicality) <- c("C", "D", "D3", "E", "F", "G", "M", "N", "T", "X1", "X10", "X11")
colnames(lutraria.typicality) <- "lutraria.typicality"
lutraria.typicality <- round(lutraria.typicality, digits=6)
lutraria.typicality
## lutraria.typicality
## C 0
## D 0
## D3 0
## E 0
## F 0
## G 0
## M 0
## N 0
## T 0
## X1 0
## X10 0
## X11 0
It is most likely that the drawing of Ozestheria lutraria in Brady (1886) belongs to C (44.2%) or D3 (33.1%). But, according to the low “typicality probabilities”, the drawing of O. lutraria remains an outlier for either species.
### 9 Classify specimen to species
dictyon <- colMeans(shape_8[c(243:245), c(2:15)]) #new specimen to classify
# get classification score
p.C <- dictyon%*%cj.C+cj0.C+log(All.lda$prior[1])
p.D <- dictyon%*%cj.D+cj0.D+log(All.lda$prior[2])
p.D3 <- dictyon%*%cj.D3+cj0.D3+log(All.lda$prior[3])
p.E <- dictyon%*%cj.E+cj0.E+log(All.lda$prior[4])
p.F <- dictyon%*%cj.F+cj0.F+log(All.lda$prior[5])
p.G <- dictyon%*%cj.G+cj0.G+log(All.lda$prior[6])
p.M <- dictyon%*%cj.M+cj0.M+log(All.lda$prior[7])
p.N <- dictyon%*%cj.N+cj0.N+log(All.lda$prior[8])
p.T <- dictyon%*%cj.T+cj0.T+log(All.lda$prior[9])
p.X1 <- dictyon%*%cj.X1+cj0.X1+log(All.lda$prior[10])
p.X10 <- dictyon%*%cj.X10+cj0.X10+log(All.lda$prior[11])
p.X11 <- dictyon%*%cj.X11+cj0.X11+log(All.lda$prior[12])
# posterior probability
post.C <- (exp(p.C-p.C))/(exp(p.D-p.C)+exp(p.C-p.C)+exp(p.D3-p.C)+exp(p.E-p.C)+exp(p.F-p.C)+exp(p.G-p.C)+exp(p.M-p.C)+exp(p.N-p.C)+exp(p.T-p.C)+exp(p.X1-p.C)+exp(p.X10-p.C)+exp(p.X11-p.C))
post.D <- (exp(p.D-p.C))/(exp(p.D-p.C)+exp(p.C-p.C)+exp(p.D3-p.C)+exp(p.E-p.C)+exp(p.F-p.C)+exp(p.G-p.C)+exp(p.M-p.C)+exp(p.N-p.C)+exp(p.T-p.C)+exp(p.X1-p.C)+exp(p.X10-p.C)+exp(p.X11-p.C))
post.D3 <- (exp(p.D3-p.C))/(exp(p.D-p.C)+exp(p.C-p.C)+exp(p.D3-p.C)+exp(p.E-p.C)+exp(p.F-p.C)+exp(p.G-p.C)+exp(p.M-p.C)+exp(p.N-p.C)+exp(p.T-p.C)+exp(p.X1-p.C)+exp(p.X10-p.C)+exp(p.X11-p.C))
post.E <- (exp(p.E-p.C))/(exp(p.D-p.C)+exp(p.C-p.C)+exp(p.D3-p.C)+exp(p.E-p.C)+exp(p.F-p.C)+exp(p.G-p.C)+exp(p.M-p.C)+exp(p.N-p.C)+exp(p.T-p.C)+exp(p.X1-p.C)+exp(p.X10-p.C)+exp(p.X11-p.C))
post.F <- (exp(p.F-p.C))/(exp(p.D-p.C)+exp(p.C-p.C)+exp(p.D3-p.C)+exp(p.E-p.C)+exp(p.F-p.C)+exp(p.G-p.C)+exp(p.M-p.C)+exp(p.N-p.C)+exp(p.T-p.C)+exp(p.X1-p.C)+exp(p.X10-p.C)+exp(p.X11-p.C))
post.G <- (exp(p.G-p.C))/(exp(p.D-p.C)+exp(p.C-p.C)+exp(p.D3-p.C)+exp(p.E-p.C)+exp(p.F-p.C)+exp(p.G-p.C)+exp(p.M-p.C)+exp(p.N-p.C)+exp(p.T-p.C)+exp(p.X1-p.C)+exp(p.X10-p.C)+exp(p.X11-p.C))
post.M <- (exp(p.M-p.C))/(exp(p.D-p.C)+exp(p.C-p.C)+exp(p.D3-p.C)+exp(p.E-p.C)+exp(p.F-p.C)+exp(p.G-p.C)+exp(p.M-p.C)+exp(p.N-p.C)+exp(p.T-p.C)+exp(p.X1-p.C)+exp(p.X10-p.C)+exp(p.X11-p.C))
post.N <- (exp(p.N-p.C))/(exp(p.D-p.C)+exp(p.C-p.C)+exp(p.D3-p.C)+exp(p.E-p.C)+exp(p.F-p.C)+exp(p.G-p.C)+exp(p.M-p.C)+exp(p.N-p.C)+exp(p.T-p.C)+exp(p.X1-p.C)+exp(p.X10-p.C)+exp(p.X11-p.C))
post.T <- (exp(p.T-p.C))/(exp(p.D-p.C)+exp(p.C-p.C)+exp(p.D3-p.C)+exp(p.E-p.C)+exp(p.F-p.C)+exp(p.G-p.C)+exp(p.M-p.C)+exp(p.N-p.C)+exp(p.T-p.C)+exp(p.X1-p.C)+exp(p.X10-p.C)+exp(p.X11-p.C))
post.X1 <- (exp(p.X1-p.C))/(exp(p.D-p.C)+exp(p.C-p.C)+exp(p.D3-p.C)+exp(p.E-p.C)+exp(p.F-p.C)+exp(p.G-p.C)+exp(p.M-p.C)+exp(p.N-p.C)+exp(p.T-p.C)+exp(p.X1-p.C)+exp(p.X10-p.C)+exp(p.X11-p.C))
post.X10 <- (exp(p.X10-p.C))/(exp(p.D-p.C)+exp(p.C-p.C)+exp(p.D3-p.C)+exp(p.E-p.C)+exp(p.F-p.C)+exp(p.G-p.C)+exp(p.M-p.C)+exp(p.N-p.C)+exp(p.T-p.C)+exp(p.X1-p.C)+exp(p.X10-p.C)+exp(p.X11-p.C))
post.X11 <- (exp(p.X11-p.C))/(exp(p.D-p.C)+exp(p.C-p.C)+exp(p.D3-p.C)+exp(p.E-p.C)+exp(p.F-p.C)+exp(p.G-p.C)+exp(p.M-p.C)+exp(p.N-p.C)+exp(p.T-p.C)+exp(p.X1-p.C)+exp(p.X10-p.C)+exp(p.X11-p.C))
dictyon.posteriors <- as.matrix(c(post.C, post.D, post.D3, post.E, post.F, post.G, post.M, post.N, post.T, post.X1, post.X10, post.X11))
rownames(dictyon.posteriors) <- c("C", "D", "D3", "E", "F", "G", "M", "N", "T", "X1", "X10", "X11")
colnames(dictyon.posteriors) <- "dictyon.posteriors"
dictyon.posteriors <- round(dictyon.posteriors, digits=2)
dictyon.posteriors
## dictyon.posteriors
## C 1
## D 0
## D3 0
## E 0
## F 0
## G 0
## M 0
## N 0
## T 0
## X1 0
## X10 0
## X11 0
#typicality probability
d2.C <- (t(as.vector(dictyon)-mean.C))%*%solve(cov.d)%*%(as.vector(dictyon)-mean.C)
typicality.C <- pchisq(d2.C, df = 14, lower.tail = FALSE)
d2.D <- (t(as.vector(dictyon)-mean.D))%*%solve(cov.d)%*%(as.vector(dictyon)-mean.D)
typicality.D <- pchisq(d2.D, df = 14, lower.tail = FALSE)
d2.D3 <- (t(as.vector(dictyon)-mean.D3))%*%solve(cov.d)%*%(as.vector(dictyon)-mean.D3)
typicality.D3 <- pchisq(d2.D3, df = 14, lower.tail = FALSE)
d2.E <- (t(as.vector(dictyon)-mean.E))%*%solve(cov.d)%*%(as.vector(dictyon)-mean.E)
typicality.E <- pchisq(d2.E, df = 14, lower.tail = FALSE)
d2.F <- (t(as.vector(dictyon)-mean.F))%*%solve(cov.d)%*%(as.vector(dictyon)-mean.F)
typicality.F <- pchisq(d2.F, df = 14, lower.tail = FALSE)
d2.G <- (t(as.vector(dictyon)-mean.G))%*%solve(cov.d)%*%(as.vector(dictyon)-mean.G)
typicality.G <- pchisq(d2.G, df = 14, lower.tail = FALSE)
d2.M <- (t(as.vector(dictyon)-mean.M))%*%solve(cov.d)%*%(as.vector(dictyon)-mean.M)
typicality.M <- pchisq(d2.M, df = 14, lower.tail = FALSE)
d2.N <- (t(as.vector(dictyon)-mean.N))%*%solve(cov.d)%*%(as.vector(dictyon)-mean.N)
typicality.N <- pchisq(d2.N, df = 14, lower.tail = FALSE)
d2.T <- (t(as.vector(dictyon)-mean.T))%*%solve(cov.d)%*%(as.vector(dictyon)-mean.T)
typicality.T <- pchisq(d2.T, df = 14, lower.tail = FALSE)
d2.X1 <- (t(as.vector(dictyon)-mean.X1))%*%solve(cov.d)%*%(as.vector(dictyon)-mean.X1)
typicality.X1 <- pchisq(d2.X1, df = 14, lower.tail = FALSE)
d2.X10 <- (t(as.vector(dictyon)-mean.X10))%*%solve(cov.d)%*%(as.vector(dictyon)-mean.X10)
typicality.X10 <- pchisq(d2.X10, df = 14, lower.tail = FALSE)
d2.X11 <- (t(as.vector(dictyon)-mean.X11))%*%solve(cov.d)%*%(as.vector(dictyon)-mean.X11)
typicality.X11 <- pchisq(d2.X11, df = 14, lower.tail = FALSE)
dictyon.typicality <- as.matrix(c(typicality.C, typicality.D, typicality.D3, typicality.E, typicality.F, typicality.G, typicality.M, typicality.N, typicality.T, typicality.X1, typicality.X10, typicality.X11))
rownames(dictyon.typicality) <- c("C", "D", "D3", "E", "F", "G", "M", "N", "T", "X1", "X10", "X11")
colnames(dictyon.typicality) <- "dictyon.typicality"
dictyon.typicality <- round(dictyon.typicality, digits=6)
dictyon.typicality
## dictyon.typicality
## C 0.124826
## D 0.000000
## D3 0.000000
## E 0.000000
## F 0.000000
## G 0.000000
## M 0.000000
## N 0.000000
## T 0.000000
## X1 0.000000
## X10 0.000000
## X11 0.000000
The mean shape of the three syntypes of Ozestheria dictyon can be assigned to and is typical of C (100%).
### 9 Classify specimen to species
rubra <- shape_8[1, c(2:15)] #new specimen to classify
rubra <- as.matrix(rubra)
# get classification score
p.C <- rubra%*%cj.C+cj0.C+log(All.lda$prior[1])
p.D <- rubra%*%cj.D+cj0.D+log(All.lda$prior[2])
p.D3 <- rubra%*%cj.D3+cj0.D3+log(All.lda$prior[3])
p.E <- rubra%*%cj.E+cj0.E+log(All.lda$prior[4])
p.F <- rubra%*%cj.F+cj0.F+log(All.lda$prior[5])
p.G <- rubra%*%cj.G+cj0.G+log(All.lda$prior[6])
p.M <- rubra%*%cj.M+cj0.M+log(All.lda$prior[7])
p.N <- rubra%*%cj.N+cj0.N+log(All.lda$prior[8])
p.T <- rubra%*%cj.T+cj0.T+log(All.lda$prior[9])
p.X1 <- rubra%*%cj.X1+cj0.X1+log(All.lda$prior[10])
p.X10 <- rubra%*%cj.X10+cj0.X10+log(All.lda$prior[11])
p.X11 <- rubra%*%cj.X11+cj0.X11+log(All.lda$prior[12])
# posterior probability
post.C <- (exp(p.C-p.C))/(exp(p.D-p.C)+exp(p.C-p.C)+exp(p.D3-p.C)+exp(p.E-p.C)+exp(p.F-p.C)+exp(p.G-p.C)+exp(p.M-p.C)+exp(p.N-p.C)+exp(p.T-p.C)+exp(p.X1-p.C)+exp(p.X10-p.C)+exp(p.X11-p.C))
post.D <- (exp(p.D-p.C))/(exp(p.D-p.C)+exp(p.C-p.C)+exp(p.D3-p.C)+exp(p.E-p.C)+exp(p.F-p.C)+exp(p.G-p.C)+exp(p.M-p.C)+exp(p.N-p.C)+exp(p.T-p.C)+exp(p.X1-p.C)+exp(p.X10-p.C)+exp(p.X11-p.C))
post.D3 <- (exp(p.D3-p.C))/(exp(p.D-p.C)+exp(p.C-p.C)+exp(p.D3-p.C)+exp(p.E-p.C)+exp(p.F-p.C)+exp(p.G-p.C)+exp(p.M-p.C)+exp(p.N-p.C)+exp(p.T-p.C)+exp(p.X1-p.C)+exp(p.X10-p.C)+exp(p.X11-p.C))
post.E <- (exp(p.E-p.C))/(exp(p.D-p.C)+exp(p.C-p.C)+exp(p.D3-p.C)+exp(p.E-p.C)+exp(p.F-p.C)+exp(p.G-p.C)+exp(p.M-p.C)+exp(p.N-p.C)+exp(p.T-p.C)+exp(p.X1-p.C)+exp(p.X10-p.C)+exp(p.X11-p.C))
post.F <- (exp(p.F-p.C))/(exp(p.D-p.C)+exp(p.C-p.C)+exp(p.D3-p.C)+exp(p.E-p.C)+exp(p.F-p.C)+exp(p.G-p.C)+exp(p.M-p.C)+exp(p.N-p.C)+exp(p.T-p.C)+exp(p.X1-p.C)+exp(p.X10-p.C)+exp(p.X11-p.C))
post.G <- (exp(p.G-p.C))/(exp(p.D-p.C)+exp(p.C-p.C)+exp(p.D3-p.C)+exp(p.E-p.C)+exp(p.F-p.C)+exp(p.G-p.C)+exp(p.M-p.C)+exp(p.N-p.C)+exp(p.T-p.C)+exp(p.X1-p.C)+exp(p.X10-p.C)+exp(p.X11-p.C))
post.M <- (exp(p.M-p.C))/(exp(p.D-p.C)+exp(p.C-p.C)+exp(p.D3-p.C)+exp(p.E-p.C)+exp(p.F-p.C)+exp(p.G-p.C)+exp(p.M-p.C)+exp(p.N-p.C)+exp(p.T-p.C)+exp(p.X1-p.C)+exp(p.X10-p.C)+exp(p.X11-p.C))
post.N <- (exp(p.N-p.C))/(exp(p.D-p.C)+exp(p.C-p.C)+exp(p.D3-p.C)+exp(p.E-p.C)+exp(p.F-p.C)+exp(p.G-p.C)+exp(p.M-p.C)+exp(p.N-p.C)+exp(p.T-p.C)+exp(p.X1-p.C)+exp(p.X10-p.C)+exp(p.X11-p.C))
post.T <- (exp(p.T-p.C))/(exp(p.D-p.C)+exp(p.C-p.C)+exp(p.D3-p.C)+exp(p.E-p.C)+exp(p.F-p.C)+exp(p.G-p.C)+exp(p.M-p.C)+exp(p.N-p.C)+exp(p.T-p.C)+exp(p.X1-p.C)+exp(p.X10-p.C)+exp(p.X11-p.C))
post.X1 <- (exp(p.X1-p.C))/(exp(p.D-p.C)+exp(p.C-p.C)+exp(p.D3-p.C)+exp(p.E-p.C)+exp(p.F-p.C)+exp(p.G-p.C)+exp(p.M-p.C)+exp(p.N-p.C)+exp(p.T-p.C)+exp(p.X1-p.C)+exp(p.X10-p.C)+exp(p.X11-p.C))
post.X10 <- (exp(p.X10-p.C))/(exp(p.D-p.C)+exp(p.C-p.C)+exp(p.D3-p.C)+exp(p.E-p.C)+exp(p.F-p.C)+exp(p.G-p.C)+exp(p.M-p.C)+exp(p.N-p.C)+exp(p.T-p.C)+exp(p.X1-p.C)+exp(p.X10-p.C)+exp(p.X11-p.C))
post.X11 <- (exp(p.X11-p.C))/(exp(p.D-p.C)+exp(p.C-p.C)+exp(p.D3-p.C)+exp(p.E-p.C)+exp(p.F-p.C)+exp(p.G-p.C)+exp(p.M-p.C)+exp(p.N-p.C)+exp(p.T-p.C)+exp(p.X1-p.C)+exp(p.X10-p.C)+exp(p.X11-p.C))
rubra.posteriors <- as.matrix(c(post.C, post.D, post.D3, post.E, post.F, post.G, post.M, post.N, post.T, post.X1, post.X10, post.X11))
rownames(rubra.posteriors) <- c("C", "D", "D3", "E", "F", "G", "M", "N", "T", "X1", "X10", "X11")
colnames(rubra.posteriors) <- "rubra.posteriors"
rubra.posteriors <- round(rubra.posteriors, digits=3)
rubra.posteriors
## rubra.posteriors
## C 0.000
## D 0.978
## D3 0.004
## E 0.000
## F 0.000
## G 0.000
## M 0.000
## N 0.001
## T 0.000
## X1 0.017
## X10 0.000
## X11 0.000
#rubra <- as.matrix(c(post.C, post.D, post.D3, post.E, post.F, post.G, post.M, post.N, post.T, post.X1, post.X10, post.X11))
#rownames(rubra) <- c("C", "D", "D3", "E", "F", "G", "M", "N", "T", "X1", "X10", "X11")
#colnames(rubra) <- "rubra"
#rubra
#typicality probability
d2.C <- (t(as.vector(rubra)-mean.C))%*%solve(cov.d)%*%(as.vector(rubra)-mean.C)
typicality.C <- pchisq(d2.C, df = 14, lower.tail = FALSE)
d2.D <- (t(as.vector(rubra)-mean.D))%*%solve(cov.d)%*%(as.vector(rubra)-mean.D)
typicality.D <- pchisq(d2.D, df = 14, lower.tail = FALSE)
d2.D3 <- (t(as.vector(rubra)-mean.D3))%*%solve(cov.d)%*%(as.vector(rubra)-mean.D3)
typicality.D3 <- pchisq(d2.D3, df = 14, lower.tail = FALSE)
d2.E <- (t(as.vector(rubra)-mean.E))%*%solve(cov.d)%*%(as.vector(rubra)-mean.E)
typicality.E <- pchisq(d2.E, df = 14, lower.tail = FALSE)
d2.F <- (t(as.vector(rubra)-mean.F))%*%solve(cov.d)%*%(as.vector(rubra)-mean.F)
typicality.F <- pchisq(d2.F, df = 14, lower.tail = FALSE)
d2.G <- (t(as.vector(rubra)-mean.G))%*%solve(cov.d)%*%(as.vector(rubra)-mean.G)
typicality.G <- pchisq(d2.G, df = 14, lower.tail = FALSE)
d2.M <- (t(as.vector(rubra)-mean.M))%*%solve(cov.d)%*%(as.vector(rubra)-mean.M)
typicality.M <- pchisq(d2.M, df = 14, lower.tail = FALSE)
d2.N <- (t(as.vector(rubra)-mean.N))%*%solve(cov.d)%*%(as.vector(rubra)-mean.N)
typicality.N <- pchisq(d2.N, df = 14, lower.tail = FALSE)
d2.T <- (t(as.vector(rubra)-mean.T))%*%solve(cov.d)%*%(as.vector(rubra)-mean.T)
typicality.T <- pchisq(d2.T, df = 14, lower.tail = FALSE)
d2.X1 <- (t(as.vector(rubra)-mean.X1))%*%solve(cov.d)%*%(as.vector(rubra)-mean.X1)
typicality.X1 <- pchisq(d2.X1, df = 14, lower.tail = FALSE)
d2.X10 <- (t(as.vector(rubra)-mean.X10))%*%solve(cov.d)%*%(as.vector(rubra)-mean.X10)
typicality.X10 <- pchisq(d2.X10, df = 14, lower.tail = FALSE)
d2.X11 <- (t(as.vector(rubra)-mean.X11))%*%solve(cov.d)%*%(as.vector(rubra)-mean.X11)
typicality.X11 <- pchisq(d2.X11, df = 14, lower.tail = FALSE)
rubra.typicality <- as.matrix(c(typicality.C, typicality.D, typicality.D3, typicality.E, typicality.F, typicality.G, typicality.M, typicality.N, typicality.T, typicality.X1, typicality.X10, typicality.X11))
rownames(rubra.typicality) <- c("C", "D", "D3", "E", "F", "G", "M", "N", "T", "X1", "X10", "X11")
colnames(rubra.typicality) <- "rubra.typicality"
rubra.typicality <- round(rubra.typicality, digits=6)
rubra.typicality
## rubra.typicality
## C 0.000000
## D 0.957211
## D3 0.473871
## E 0.000000
## F 0.039319
## G 0.010612
## M 0.000030
## N 0.074841
## T 0.000000
## X1 0.538961
## X10 0.000000
## X11 0.000000
The type specimen of Ozestheria rubra can be assigned to D (97.8%).
### 9 Classify specimen to species
elliptica <- shape_8[241, c(2:15)] #new specimen to classify
elliptica <- as.matrix(elliptica)
# get classification score
p.C <- elliptica%*%cj.C+cj0.C+log(All.lda$prior[1])
p.D <- elliptica%*%cj.D+cj0.D+log(All.lda$prior[2])
p.D3 <- elliptica%*%cj.D3+cj0.D3+log(All.lda$prior[3])
p.E <- elliptica%*%cj.E+cj0.E+log(All.lda$prior[4])
p.F <- elliptica%*%cj.F+cj0.F+log(All.lda$prior[5])
p.G <- elliptica%*%cj.G+cj0.G+log(All.lda$prior[6])
p.M <- elliptica%*%cj.M+cj0.M+log(All.lda$prior[7])
p.N <- elliptica%*%cj.N+cj0.N+log(All.lda$prior[8])
p.T <- elliptica%*%cj.T+cj0.T+log(All.lda$prior[9])
p.X1 <- elliptica%*%cj.X1+cj0.X1+log(All.lda$prior[10])
p.X10 <- elliptica%*%cj.X10+cj0.X10+log(All.lda$prior[11])
p.X11 <- elliptica%*%cj.X11+cj0.X11+log(All.lda$prior[12])
# posterior probability
post.C <- (exp(p.C-p.C))/(exp(p.D-p.C)+exp(p.C-p.C)+exp(p.D3-p.C)+exp(p.E-p.C)+exp(p.F-p.C)+exp(p.G-p.C)+exp(p.M-p.C)+exp(p.N-p.C)+exp(p.T-p.C)+exp(p.X1-p.C)+exp(p.X10-p.C)+exp(p.X11-p.C))
post.D <- (exp(p.D-p.C))/(exp(p.D-p.C)+exp(p.C-p.C)+exp(p.D3-p.C)+exp(p.E-p.C)+exp(p.F-p.C)+exp(p.G-p.C)+exp(p.M-p.C)+exp(p.N-p.C)+exp(p.T-p.C)+exp(p.X1-p.C)+exp(p.X10-p.C)+exp(p.X11-p.C))
post.D3 <- (exp(p.D3-p.C))/(exp(p.D-p.C)+exp(p.C-p.C)+exp(p.D3-p.C)+exp(p.E-p.C)+exp(p.F-p.C)+exp(p.G-p.C)+exp(p.M-p.C)+exp(p.N-p.C)+exp(p.T-p.C)+exp(p.X1-p.C)+exp(p.X10-p.C)+exp(p.X11-p.C))
post.E <- (exp(p.E-p.C))/(exp(p.D-p.C)+exp(p.C-p.C)+exp(p.D3-p.C)+exp(p.E-p.C)+exp(p.F-p.C)+exp(p.G-p.C)+exp(p.M-p.C)+exp(p.N-p.C)+exp(p.T-p.C)+exp(p.X1-p.C)+exp(p.X10-p.C)+exp(p.X11-p.C))
post.F <- (exp(p.F-p.C))/(exp(p.D-p.C)+exp(p.C-p.C)+exp(p.D3-p.C)+exp(p.E-p.C)+exp(p.F-p.C)+exp(p.G-p.C)+exp(p.M-p.C)+exp(p.N-p.C)+exp(p.T-p.C)+exp(p.X1-p.C)+exp(p.X10-p.C)+exp(p.X11-p.C))
post.G <- (exp(p.G-p.C))/(exp(p.D-p.C)+exp(p.C-p.C)+exp(p.D3-p.C)+exp(p.E-p.C)+exp(p.F-p.C)+exp(p.G-p.C)+exp(p.M-p.C)+exp(p.N-p.C)+exp(p.T-p.C)+exp(p.X1-p.C)+exp(p.X10-p.C)+exp(p.X11-p.C))
post.M <- (exp(p.M-p.C))/(exp(p.D-p.C)+exp(p.C-p.C)+exp(p.D3-p.C)+exp(p.E-p.C)+exp(p.F-p.C)+exp(p.G-p.C)+exp(p.M-p.C)+exp(p.N-p.C)+exp(p.T-p.C)+exp(p.X1-p.C)+exp(p.X10-p.C)+exp(p.X11-p.C))
post.N <- (exp(p.N-p.C))/(exp(p.D-p.C)+exp(p.C-p.C)+exp(p.D3-p.C)+exp(p.E-p.C)+exp(p.F-p.C)+exp(p.G-p.C)+exp(p.M-p.C)+exp(p.N-p.C)+exp(p.T-p.C)+exp(p.X1-p.C)+exp(p.X10-p.C)+exp(p.X11-p.C))
post.T <- (exp(p.T-p.C))/(exp(p.D-p.C)+exp(p.C-p.C)+exp(p.D3-p.C)+exp(p.E-p.C)+exp(p.F-p.C)+exp(p.G-p.C)+exp(p.M-p.C)+exp(p.N-p.C)+exp(p.T-p.C)+exp(p.X1-p.C)+exp(p.X10-p.C)+exp(p.X11-p.C))
post.X1 <- (exp(p.X1-p.C))/(exp(p.D-p.C)+exp(p.C-p.C)+exp(p.D3-p.C)+exp(p.E-p.C)+exp(p.F-p.C)+exp(p.G-p.C)+exp(p.M-p.C)+exp(p.N-p.C)+exp(p.T-p.C)+exp(p.X1-p.C)+exp(p.X10-p.C)+exp(p.X11-p.C))
post.X10 <- (exp(p.X10-p.C))/(exp(p.D-p.C)+exp(p.C-p.C)+exp(p.D3-p.C)+exp(p.E-p.C)+exp(p.F-p.C)+exp(p.G-p.C)+exp(p.M-p.C)+exp(p.N-p.C)+exp(p.T-p.C)+exp(p.X1-p.C)+exp(p.X10-p.C)+exp(p.X11-p.C))
post.X11 <- (exp(p.X11-p.C))/(exp(p.D-p.C)+exp(p.C-p.C)+exp(p.D3-p.C)+exp(p.E-p.C)+exp(p.F-p.C)+exp(p.G-p.C)+exp(p.M-p.C)+exp(p.N-p.C)+exp(p.T-p.C)+exp(p.X1-p.C)+exp(p.X10-p.C)+exp(p.X11-p.C))
elliptica.posteriors <- as.matrix(c(post.C, post.D, post.D3, post.E, post.F, post.G, post.M, post.N, post.T, post.X1, post.X10, post.X11))
rownames(elliptica.posteriors) <- c("C", "D", "D3", "E", "F", "G", "M", "N", "T", "X1", "X10", "X11")
colnames(elliptica.posteriors) <- "elliptica.posteriors"
elliptica.posteriors <- round(elliptica.posteriors, digits=3)
elliptica.posteriors
## elliptica.posteriors
## C 0.000
## D 0.211
## D3 0.001
## E 0.000
## F 0.010
## G 0.000
## M 0.000
## N 0.091
## T 0.000
## X1 0.686
## X10 0.000
## X11 0.000
#typicality probability
d2.C <- (t(as.vector(elliptica)-mean.C))%*%solve(cov.d)%*%(as.vector(elliptica)-mean.C)
typicality.C <- pchisq(d2.C, df = 14, lower.tail = FALSE)
d2.D <- (t(as.vector(elliptica)-mean.D))%*%solve(cov.d)%*%(as.vector(elliptica)-mean.D)
typicality.D <- pchisq(d2.D, df = 14, lower.tail = FALSE)
d2.D3 <- (t(as.vector(elliptica)-mean.D3))%*%solve(cov.d)%*%(as.vector(elliptica)-mean.D3)
typicality.D3 <- pchisq(d2.D3, df = 14, lower.tail = FALSE)
d2.E <- (t(as.vector(elliptica)-mean.E))%*%solve(cov.d)%*%(as.vector(elliptica)-mean.E)
typicality.E <- pchisq(d2.E, df = 14, lower.tail = FALSE)
d2.F <- (t(as.vector(elliptica)-mean.F))%*%solve(cov.d)%*%(as.vector(elliptica)-mean.F)
typicality.F <- pchisq(d2.F, df = 14, lower.tail = FALSE)
d2.G <- (t(as.vector(elliptica)-mean.G))%*%solve(cov.d)%*%(as.vector(elliptica)-mean.G)
typicality.G <- pchisq(d2.G, df = 14, lower.tail = FALSE)
d2.M <- (t(as.vector(elliptica)-mean.M))%*%solve(cov.d)%*%(as.vector(elliptica)-mean.M)
typicality.M <- pchisq(d2.M, df = 14, lower.tail = FALSE)
d2.N <- (t(as.vector(elliptica)-mean.N))%*%solve(cov.d)%*%(as.vector(elliptica)-mean.N)
typicality.N <- pchisq(d2.N, df = 14, lower.tail = FALSE)
d2.T <- (t(as.vector(elliptica)-mean.T))%*%solve(cov.d)%*%(as.vector(elliptica)-mean.T)
typicality.T <- pchisq(d2.T, df = 14, lower.tail = FALSE)
d2.X1 <- (t(as.vector(elliptica)-mean.X1))%*%solve(cov.d)%*%(as.vector(elliptica)-mean.X1)
typicality.X1 <- pchisq(d2.X1, df = 14, lower.tail = FALSE)
d2.X10 <- (t(as.vector(elliptica)-mean.X10))%*%solve(cov.d)%*%(as.vector(elliptica)-mean.X10)
typicality.X10 <- pchisq(d2.X10, df = 14, lower.tail = FALSE)
d2.X11 <- (t(as.vector(elliptica)-mean.X11))%*%solve(cov.d)%*%(as.vector(elliptica)-mean.X11)
typicality.X11 <- pchisq(d2.X11, df = 14, lower.tail = FALSE)
elliptica.typicality <- as.matrix(c(typicality.C, typicality.D, typicality.D3, typicality.E, typicality.F, typicality.G, typicality.M, typicality.N, typicality.T, typicality.X1, typicality.X10, typicality.X11))
rownames(elliptica.typicality) <- c("C", "D", "D3", "E", "F", "G", "M", "N", "T", "X1", "X10", "X11")
colnames(elliptica.typicality) <- "elliptica.typicality"
elliptica.typicality <- round(elliptica.typicality, digits=6)
elliptica.typicality
## elliptica.typicality
## C 0.000000
## D 0.113626
## D3 0.019960
## E 0.000000
## F 0.060601
## G 0.000000
## M 0.000011
## N 0.057743
## T 0.000000
## X1 0.277728
## X10 0.000000
## X11 0.000000
The drawing of Ozestheria elliptica can be assigned to X1 (68.6%), D (21.1%) or N (9.1%).
### 9 Classify specimen to species
berneyi <- shape_8[213, c(2:15)] #new specimen to classify
berneyi <- as.matrix(berneyi)
# get classification score
p.C <- berneyi%*%cj.C+cj0.C+log(All.lda$prior[1])
p.D <- berneyi%*%cj.D+cj0.D+log(All.lda$prior[2])
p.D3 <- berneyi%*%cj.D3+cj0.D3+log(All.lda$prior[3])
p.E <- berneyi%*%cj.E+cj0.E+log(All.lda$prior[4])
p.F <- berneyi%*%cj.F+cj0.F+log(All.lda$prior[5])
p.G <- berneyi%*%cj.G+cj0.G+log(All.lda$prior[6])
p.M <- berneyi%*%cj.M+cj0.M+log(All.lda$prior[7])
p.N <- berneyi%*%cj.N+cj0.N+log(All.lda$prior[8])
p.T <- berneyi%*%cj.T+cj0.T+log(All.lda$prior[9])
p.X1 <- berneyi%*%cj.X1+cj0.X1+log(All.lda$prior[10])
p.X10 <- berneyi%*%cj.X10+cj0.X10+log(All.lda$prior[11])
p.X11 <- berneyi%*%cj.X11+cj0.X11+log(All.lda$prior[12])
# posterior probability
post.C <- (exp(p.C-p.C))/(exp(p.D-p.C)+exp(p.C-p.C)+exp(p.D3-p.C)+exp(p.E-p.C)+exp(p.F-p.C)+exp(p.G-p.C)+exp(p.M-p.C)+exp(p.N-p.C)+exp(p.T-p.C)+exp(p.X1-p.C)+exp(p.X10-p.C)+exp(p.X11-p.C))
post.D <- (exp(p.D-p.C))/(exp(p.D-p.C)+exp(p.C-p.C)+exp(p.D3-p.C)+exp(p.E-p.C)+exp(p.F-p.C)+exp(p.G-p.C)+exp(p.M-p.C)+exp(p.N-p.C)+exp(p.T-p.C)+exp(p.X1-p.C)+exp(p.X10-p.C)+exp(p.X11-p.C))
post.D3 <- (exp(p.D3-p.C))/(exp(p.D-p.C)+exp(p.C-p.C)+exp(p.D3-p.C)+exp(p.E-p.C)+exp(p.F-p.C)+exp(p.G-p.C)+exp(p.M-p.C)+exp(p.N-p.C)+exp(p.T-p.C)+exp(p.X1-p.C)+exp(p.X10-p.C)+exp(p.X11-p.C))
post.E <- (exp(p.E-p.C))/(exp(p.D-p.C)+exp(p.C-p.C)+exp(p.D3-p.C)+exp(p.E-p.C)+exp(p.F-p.C)+exp(p.G-p.C)+exp(p.M-p.C)+exp(p.N-p.C)+exp(p.T-p.C)+exp(p.X1-p.C)+exp(p.X10-p.C)+exp(p.X11-p.C))
post.F <- (exp(p.F-p.C))/(exp(p.D-p.C)+exp(p.C-p.C)+exp(p.D3-p.C)+exp(p.E-p.C)+exp(p.F-p.C)+exp(p.G-p.C)+exp(p.M-p.C)+exp(p.N-p.C)+exp(p.T-p.C)+exp(p.X1-p.C)+exp(p.X10-p.C)+exp(p.X11-p.C))
post.G <- (exp(p.G-p.C))/(exp(p.D-p.C)+exp(p.C-p.C)+exp(p.D3-p.C)+exp(p.E-p.C)+exp(p.F-p.C)+exp(p.G-p.C)+exp(p.M-p.C)+exp(p.N-p.C)+exp(p.T-p.C)+exp(p.X1-p.C)+exp(p.X10-p.C)+exp(p.X11-p.C))
post.M <- (exp(p.M-p.C))/(exp(p.D-p.C)+exp(p.C-p.C)+exp(p.D3-p.C)+exp(p.E-p.C)+exp(p.F-p.C)+exp(p.G-p.C)+exp(p.M-p.C)+exp(p.N-p.C)+exp(p.T-p.C)+exp(p.X1-p.C)+exp(p.X10-p.C)+exp(p.X11-p.C))
post.N <- (exp(p.N-p.C))/(exp(p.D-p.C)+exp(p.C-p.C)+exp(p.D3-p.C)+exp(p.E-p.C)+exp(p.F-p.C)+exp(p.G-p.C)+exp(p.M-p.C)+exp(p.N-p.C)+exp(p.T-p.C)+exp(p.X1-p.C)+exp(p.X10-p.C)+exp(p.X11-p.C))
post.T <- (exp(p.T-p.C))/(exp(p.D-p.C)+exp(p.C-p.C)+exp(p.D3-p.C)+exp(p.E-p.C)+exp(p.F-p.C)+exp(p.G-p.C)+exp(p.M-p.C)+exp(p.N-p.C)+exp(p.T-p.C)+exp(p.X1-p.C)+exp(p.X10-p.C)+exp(p.X11-p.C))
post.X1 <- (exp(p.X1-p.C))/(exp(p.D-p.C)+exp(p.C-p.C)+exp(p.D3-p.C)+exp(p.E-p.C)+exp(p.F-p.C)+exp(p.G-p.C)+exp(p.M-p.C)+exp(p.N-p.C)+exp(p.T-p.C)+exp(p.X1-p.C)+exp(p.X10-p.C)+exp(p.X11-p.C))
post.X10 <- (exp(p.X10-p.C))/(exp(p.D-p.C)+exp(p.C-p.C)+exp(p.D3-p.C)+exp(p.E-p.C)+exp(p.F-p.C)+exp(p.G-p.C)+exp(p.M-p.C)+exp(p.N-p.C)+exp(p.T-p.C)+exp(p.X1-p.C)+exp(p.X10-p.C)+exp(p.X11-p.C))
post.X11 <- (exp(p.X11-p.C))/(exp(p.D-p.C)+exp(p.C-p.C)+exp(p.D3-p.C)+exp(p.E-p.C)+exp(p.F-p.C)+exp(p.G-p.C)+exp(p.M-p.C)+exp(p.N-p.C)+exp(p.T-p.C)+exp(p.X1-p.C)+exp(p.X10-p.C)+exp(p.X11-p.C))
berneyi.posteriors <- as.matrix(c(post.C, post.D, post.D3, post.E, post.F, post.G, post.M, post.N, post.T, post.X1, post.X10, post.X11))
rownames(berneyi.posteriors) <- c("C", "D", "D3", "E", "F", "G", "M", "N", "T", "X1", "X10", "X11")
colnames(berneyi.posteriors) <- "berneyi.posteriors"
berneyi.posteriors <- round(berneyi.posteriors, digits=3)
berneyi.posteriors
## berneyi.posteriors
## C 0.000
## D 0.001
## D3 0.000
## E 0.000
## F 0.000
## G 0.000
## M 0.001
## N 0.997
## T 0.000
## X1 0.000
## X10 0.000
## X11 0.000
#typicality probability
d2.C <- (t(as.vector(berneyi)-mean.C))%*%solve(cov.d)%*%(as.vector(berneyi)-mean.C)
typicality.C <- pchisq(d2.C, df = 14, lower.tail = FALSE)
d2.D <- (t(as.vector(berneyi)-mean.D))%*%solve(cov.d)%*%(as.vector(berneyi)-mean.D)
typicality.D <- pchisq(d2.D, df = 14, lower.tail = FALSE)
d2.D3 <- (t(as.vector(berneyi)-mean.D3))%*%solve(cov.d)%*%(as.vector(berneyi)-mean.D3)
typicality.D3 <- pchisq(d2.D3, df = 14, lower.tail = FALSE)
d2.E <- (t(as.vector(berneyi)-mean.E))%*%solve(cov.d)%*%(as.vector(berneyi)-mean.E)
typicality.E <- pchisq(d2.E, df = 14, lower.tail = FALSE)
d2.F <- (t(as.vector(berneyi)-mean.F))%*%solve(cov.d)%*%(as.vector(berneyi)-mean.F)
typicality.F <- pchisq(d2.F, df = 14, lower.tail = FALSE)
d2.G <- (t(as.vector(berneyi)-mean.G))%*%solve(cov.d)%*%(as.vector(berneyi)-mean.G)
typicality.G <- pchisq(d2.G, df = 14, lower.tail = FALSE)
d2.M <- (t(as.vector(berneyi)-mean.M))%*%solve(cov.d)%*%(as.vector(berneyi)-mean.M)
typicality.M <- pchisq(d2.M, df = 14, lower.tail = FALSE)
d2.N <- (t(as.vector(berneyi)-mean.N))%*%solve(cov.d)%*%(as.vector(berneyi)-mean.N)
typicality.N <- pchisq(d2.N, df = 14, lower.tail = FALSE)
d2.T <- (t(as.vector(berneyi)-mean.T))%*%solve(cov.d)%*%(as.vector(berneyi)-mean.T)
typicality.T <- pchisq(d2.T, df = 14, lower.tail = FALSE)
d2.X1 <- (t(as.vector(berneyi)-mean.X1))%*%solve(cov.d)%*%(as.vector(berneyi)-mean.X1)
typicality.X1 <- pchisq(d2.X1, df = 14, lower.tail = FALSE)
d2.X10 <- (t(as.vector(berneyi)-mean.X10))%*%solve(cov.d)%*%(as.vector(berneyi)-mean.X10)
typicality.X10 <- pchisq(d2.X10, df = 14, lower.tail = FALSE)
d2.X11 <- (t(as.vector(berneyi)-mean.X11))%*%solve(cov.d)%*%(as.vector(berneyi)-mean.X11)
typicality.X11 <- pchisq(d2.X11, df = 14, lower.tail = FALSE)
berneyi.typicality <- as.matrix(c(typicality.C, typicality.D, typicality.D3, typicality.E, typicality.F, typicality.G, typicality.M, typicality.N, typicality.T, typicality.X1, typicality.X10, typicality.X11))
rownames(berneyi.typicality) <- c("C", "D", "D3", "E", "F", "G", "M", "N", "T", "X1", "X10", "X11")
colnames(berneyi.typicality) <- "berneyi.typicality"
berneyi.typicality <- round(berneyi.typicality, digits=6)
berneyi.typicality
## berneyi.typicality
## C 0.000000
## D 0.000982
## D3 0.000021
## E 0.000000
## F 0.000000
## G 0.000015
## M 0.000975
## N 0.045654
## T 0.000000
## X1 0.000001
## X10 0.000000
## X11 0.000000
The drawing of Ozestheria berneyi (female) can be assigned to N (99.7%).
### 9 Classify specimen to species
berneyi <- shape_8[214, c(2:15)] #new specimen to classify
berneyi <- as.matrix(berneyi)
# get classification score
p.C <- berneyi%*%cj.C+cj0.C+log(All.lda$prior[1])
p.D <- berneyi%*%cj.D+cj0.D+log(All.lda$prior[2])
p.D3 <- berneyi%*%cj.D3+cj0.D3+log(All.lda$prior[3])
p.E <- berneyi%*%cj.E+cj0.E+log(All.lda$prior[4])
p.F <- berneyi%*%cj.F+cj0.F+log(All.lda$prior[5])
p.G <- berneyi%*%cj.G+cj0.G+log(All.lda$prior[6])
p.M <- berneyi%*%cj.M+cj0.M+log(All.lda$prior[7])
p.N <- berneyi%*%cj.N+cj0.N+log(All.lda$prior[8])
p.T <- berneyi%*%cj.T+cj0.T+log(All.lda$prior[9])
p.X1 <- berneyi%*%cj.X1+cj0.X1+log(All.lda$prior[10])
p.X10 <- berneyi%*%cj.X10+cj0.X10+log(All.lda$prior[11])
p.X11 <- berneyi%*%cj.X11+cj0.X11+log(All.lda$prior[12])
# posterior probability
post.C <- (exp(p.C-p.C))/(exp(p.D-p.C)+exp(p.C-p.C)+exp(p.D3-p.C)+exp(p.E-p.C)+exp(p.F-p.C)+exp(p.G-p.C)+exp(p.M-p.C)+exp(p.N-p.C)+exp(p.T-p.C)+exp(p.X1-p.C)+exp(p.X10-p.C)+exp(p.X11-p.C))
post.D <- (exp(p.D-p.C))/(exp(p.D-p.C)+exp(p.C-p.C)+exp(p.D3-p.C)+exp(p.E-p.C)+exp(p.F-p.C)+exp(p.G-p.C)+exp(p.M-p.C)+exp(p.N-p.C)+exp(p.T-p.C)+exp(p.X1-p.C)+exp(p.X10-p.C)+exp(p.X11-p.C))
post.D3 <- (exp(p.D3-p.C))/(exp(p.D-p.C)+exp(p.C-p.C)+exp(p.D3-p.C)+exp(p.E-p.C)+exp(p.F-p.C)+exp(p.G-p.C)+exp(p.M-p.C)+exp(p.N-p.C)+exp(p.T-p.C)+exp(p.X1-p.C)+exp(p.X10-p.C)+exp(p.X11-p.C))
post.E <- (exp(p.E-p.C))/(exp(p.D-p.C)+exp(p.C-p.C)+exp(p.D3-p.C)+exp(p.E-p.C)+exp(p.F-p.C)+exp(p.G-p.C)+exp(p.M-p.C)+exp(p.N-p.C)+exp(p.T-p.C)+exp(p.X1-p.C)+exp(p.X10-p.C)+exp(p.X11-p.C))
post.F <- (exp(p.F-p.C))/(exp(p.D-p.C)+exp(p.C-p.C)+exp(p.D3-p.C)+exp(p.E-p.C)+exp(p.F-p.C)+exp(p.G-p.C)+exp(p.M-p.C)+exp(p.N-p.C)+exp(p.T-p.C)+exp(p.X1-p.C)+exp(p.X10-p.C)+exp(p.X11-p.C))
post.G <- (exp(p.G-p.C))/(exp(p.D-p.C)+exp(p.C-p.C)+exp(p.D3-p.C)+exp(p.E-p.C)+exp(p.F-p.C)+exp(p.G-p.C)+exp(p.M-p.C)+exp(p.N-p.C)+exp(p.T-p.C)+exp(p.X1-p.C)+exp(p.X10-p.C)+exp(p.X11-p.C))
post.M <- (exp(p.M-p.C))/(exp(p.D-p.C)+exp(p.C-p.C)+exp(p.D3-p.C)+exp(p.E-p.C)+exp(p.F-p.C)+exp(p.G-p.C)+exp(p.M-p.C)+exp(p.N-p.C)+exp(p.T-p.C)+exp(p.X1-p.C)+exp(p.X10-p.C)+exp(p.X11-p.C))
post.N <- (exp(p.N-p.C))/(exp(p.D-p.C)+exp(p.C-p.C)+exp(p.D3-p.C)+exp(p.E-p.C)+exp(p.F-p.C)+exp(p.G-p.C)+exp(p.M-p.C)+exp(p.N-p.C)+exp(p.T-p.C)+exp(p.X1-p.C)+exp(p.X10-p.C)+exp(p.X11-p.C))
post.T <- (exp(p.T-p.C))/(exp(p.D-p.C)+exp(p.C-p.C)+exp(p.D3-p.C)+exp(p.E-p.C)+exp(p.F-p.C)+exp(p.G-p.C)+exp(p.M-p.C)+exp(p.N-p.C)+exp(p.T-p.C)+exp(p.X1-p.C)+exp(p.X10-p.C)+exp(p.X11-p.C))
post.X1 <- (exp(p.X1-p.C))/(exp(p.D-p.C)+exp(p.C-p.C)+exp(p.D3-p.C)+exp(p.E-p.C)+exp(p.F-p.C)+exp(p.G-p.C)+exp(p.M-p.C)+exp(p.N-p.C)+exp(p.T-p.C)+exp(p.X1-p.C)+exp(p.X10-p.C)+exp(p.X11-p.C))
post.X10 <- (exp(p.X10-p.C))/(exp(p.D-p.C)+exp(p.C-p.C)+exp(p.D3-p.C)+exp(p.E-p.C)+exp(p.F-p.C)+exp(p.G-p.C)+exp(p.M-p.C)+exp(p.N-p.C)+exp(p.T-p.C)+exp(p.X1-p.C)+exp(p.X10-p.C)+exp(p.X11-p.C))
post.X11 <- (exp(p.X11-p.C))/(exp(p.D-p.C)+exp(p.C-p.C)+exp(p.D3-p.C)+exp(p.E-p.C)+exp(p.F-p.C)+exp(p.G-p.C)+exp(p.M-p.C)+exp(p.N-p.C)+exp(p.T-p.C)+exp(p.X1-p.C)+exp(p.X10-p.C)+exp(p.X11-p.C))
berneyi.posteriors <- as.matrix(c(post.C, post.D, post.D3, post.E, post.F, post.G, post.M, post.N, post.T, post.X1, post.X10, post.X11))
rownames(berneyi.posteriors) <- c("C", "D", "D3", "E", "F", "G", "M", "N", "T", "X1", "X10", "X11")
colnames(berneyi.posteriors) <- "berneyi.posteriors"
berneyi.posteriors <- round(berneyi.posteriors, digits=3)
berneyi.posteriors
## berneyi.posteriors
## C 0.000
## D 0.025
## D3 0.000
## E 0.000
## F 0.000
## G 0.000
## M 0.001
## N 0.974
## T 0.000
## X1 0.000
## X10 0.000
## X11 0.000
#typicality probability
d2.C <- (t(as.vector(berneyi)-mean.C))%*%solve(cov.d)%*%(as.vector(berneyi)-mean.C)
typicality.C <- pchisq(d2.C, df = 14, lower.tail = FALSE)
d2.D <- (t(as.vector(berneyi)-mean.D))%*%solve(cov.d)%*%(as.vector(berneyi)-mean.D)
typicality.D <- pchisq(d2.D, df = 14, lower.tail = FALSE)
d2.D3 <- (t(as.vector(berneyi)-mean.D3))%*%solve(cov.d)%*%(as.vector(berneyi)-mean.D3)
typicality.D3 <- pchisq(d2.D3, df = 14, lower.tail = FALSE)
d2.E <- (t(as.vector(berneyi)-mean.E))%*%solve(cov.d)%*%(as.vector(berneyi)-mean.E)
typicality.E <- pchisq(d2.E, df = 14, lower.tail = FALSE)
d2.F <- (t(as.vector(berneyi)-mean.F))%*%solve(cov.d)%*%(as.vector(berneyi)-mean.F)
typicality.F <- pchisq(d2.F, df = 14, lower.tail = FALSE)
d2.G <- (t(as.vector(berneyi)-mean.G))%*%solve(cov.d)%*%(as.vector(berneyi)-mean.G)
typicality.G <- pchisq(d2.G, df = 14, lower.tail = FALSE)
d2.M <- (t(as.vector(berneyi)-mean.M))%*%solve(cov.d)%*%(as.vector(berneyi)-mean.M)
typicality.M <- pchisq(d2.M, df = 14, lower.tail = FALSE)
d2.N <- (t(as.vector(berneyi)-mean.N))%*%solve(cov.d)%*%(as.vector(berneyi)-mean.N)
typicality.N <- pchisq(d2.N, df = 14, lower.tail = FALSE)
d2.T <- (t(as.vector(berneyi)-mean.T))%*%solve(cov.d)%*%(as.vector(berneyi)-mean.T)
typicality.T <- pchisq(d2.T, df = 14, lower.tail = FALSE)
d2.X1 <- (t(as.vector(berneyi)-mean.X1))%*%solve(cov.d)%*%(as.vector(berneyi)-mean.X1)
typicality.X1 <- pchisq(d2.X1, df = 14, lower.tail = FALSE)
d2.X10 <- (t(as.vector(berneyi)-mean.X10))%*%solve(cov.d)%*%(as.vector(berneyi)-mean.X10)
typicality.X10 <- pchisq(d2.X10, df = 14, lower.tail = FALSE)
d2.X11 <- (t(as.vector(berneyi)-mean.X11))%*%solve(cov.d)%*%(as.vector(berneyi)-mean.X11)
typicality.X11 <- pchisq(d2.X11, df = 14, lower.tail = FALSE)
berneyi.typicality <- as.matrix(c(typicality.C, typicality.D, typicality.D3, typicality.E, typicality.F, typicality.G, typicality.M, typicality.N, typicality.T, typicality.X1, typicality.X10, typicality.X11))
rownames(berneyi.typicality) <- c("C", "D", "D3", "E", "F", "G", "M", "N", "T", "X1", "X10", "X11")
colnames(berneyi.typicality) <- "berneyi.typicality"
berneyi.typicality <- round(berneyi.typicality, digits=6)
berneyi.typicality
## berneyi.typicality
## C 0.000000
## D 0.419684
## D3 0.061387
## E 0.000000
## F 0.001626
## G 0.011840
## M 0.100272
## N 0.890740
## T 0.000000
## X1 0.008804
## X10 0.000000
## X11 0.000000
The drawing of Ozestheria berneyi (male) can be assigned to N (97.4%).
### 9 Classify specimen to species
berneyi <- shape_8[215, c(2:15)] #new specimen to classify
berneyi <- as.matrix(berneyi)
# get classification score
p.C <- berneyi%*%cj.C+cj0.C+log(All.lda$prior[1])
p.D <- berneyi%*%cj.D+cj0.D+log(All.lda$prior[2])
p.D3 <- berneyi%*%cj.D3+cj0.D3+log(All.lda$prior[3])
p.E <- berneyi%*%cj.E+cj0.E+log(All.lda$prior[4])
p.F <- berneyi%*%cj.F+cj0.F+log(All.lda$prior[5])
p.G <- berneyi%*%cj.G+cj0.G+log(All.lda$prior[6])
p.M <- berneyi%*%cj.M+cj0.M+log(All.lda$prior[7])
p.N <- berneyi%*%cj.N+cj0.N+log(All.lda$prior[8])
p.T <- berneyi%*%cj.T+cj0.T+log(All.lda$prior[9])
p.X1 <- berneyi%*%cj.X1+cj0.X1+log(All.lda$prior[10])
p.X10 <- berneyi%*%cj.X10+cj0.X10+log(All.lda$prior[11])
p.X11 <- berneyi%*%cj.X11+cj0.X11+log(All.lda$prior[12])
# posterior probability
post.C <- (exp(p.C-p.C))/(exp(p.D-p.C)+exp(p.C-p.C)+exp(p.D3-p.C)+exp(p.E-p.C)+exp(p.F-p.C)+exp(p.G-p.C)+exp(p.M-p.C)+exp(p.N-p.C)+exp(p.T-p.C)+exp(p.X1-p.C)+exp(p.X10-p.C)+exp(p.X11-p.C))
post.D <- (exp(p.D-p.C))/(exp(p.D-p.C)+exp(p.C-p.C)+exp(p.D3-p.C)+exp(p.E-p.C)+exp(p.F-p.C)+exp(p.G-p.C)+exp(p.M-p.C)+exp(p.N-p.C)+exp(p.T-p.C)+exp(p.X1-p.C)+exp(p.X10-p.C)+exp(p.X11-p.C))
post.D3 <- (exp(p.D3-p.C))/(exp(p.D-p.C)+exp(p.C-p.C)+exp(p.D3-p.C)+exp(p.E-p.C)+exp(p.F-p.C)+exp(p.G-p.C)+exp(p.M-p.C)+exp(p.N-p.C)+exp(p.T-p.C)+exp(p.X1-p.C)+exp(p.X10-p.C)+exp(p.X11-p.C))
post.E <- (exp(p.E-p.C))/(exp(p.D-p.C)+exp(p.C-p.C)+exp(p.D3-p.C)+exp(p.E-p.C)+exp(p.F-p.C)+exp(p.G-p.C)+exp(p.M-p.C)+exp(p.N-p.C)+exp(p.T-p.C)+exp(p.X1-p.C)+exp(p.X10-p.C)+exp(p.X11-p.C))
post.F <- (exp(p.F-p.C))/(exp(p.D-p.C)+exp(p.C-p.C)+exp(p.D3-p.C)+exp(p.E-p.C)+exp(p.F-p.C)+exp(p.G-p.C)+exp(p.M-p.C)+exp(p.N-p.C)+exp(p.T-p.C)+exp(p.X1-p.C)+exp(p.X10-p.C)+exp(p.X11-p.C))
post.G <- (exp(p.G-p.C))/(exp(p.D-p.C)+exp(p.C-p.C)+exp(p.D3-p.C)+exp(p.E-p.C)+exp(p.F-p.C)+exp(p.G-p.C)+exp(p.M-p.C)+exp(p.N-p.C)+exp(p.T-p.C)+exp(p.X1-p.C)+exp(p.X10-p.C)+exp(p.X11-p.C))
post.M <- (exp(p.M-p.C))/(exp(p.D-p.C)+exp(p.C-p.C)+exp(p.D3-p.C)+exp(p.E-p.C)+exp(p.F-p.C)+exp(p.G-p.C)+exp(p.M-p.C)+exp(p.N-p.C)+exp(p.T-p.C)+exp(p.X1-p.C)+exp(p.X10-p.C)+exp(p.X11-p.C))
post.N <- (exp(p.N-p.C))/(exp(p.D-p.C)+exp(p.C-p.C)+exp(p.D3-p.C)+exp(p.E-p.C)+exp(p.F-p.C)+exp(p.G-p.C)+exp(p.M-p.C)+exp(p.N-p.C)+exp(p.T-p.C)+exp(p.X1-p.C)+exp(p.X10-p.C)+exp(p.X11-p.C))
post.T <- (exp(p.T-p.C))/(exp(p.D-p.C)+exp(p.C-p.C)+exp(p.D3-p.C)+exp(p.E-p.C)+exp(p.F-p.C)+exp(p.G-p.C)+exp(p.M-p.C)+exp(p.N-p.C)+exp(p.T-p.C)+exp(p.X1-p.C)+exp(p.X10-p.C)+exp(p.X11-p.C))
post.X1 <- (exp(p.X1-p.C))/(exp(p.D-p.C)+exp(p.C-p.C)+exp(p.D3-p.C)+exp(p.E-p.C)+exp(p.F-p.C)+exp(p.G-p.C)+exp(p.M-p.C)+exp(p.N-p.C)+exp(p.T-p.C)+exp(p.X1-p.C)+exp(p.X10-p.C)+exp(p.X11-p.C))
post.X10 <- (exp(p.X10-p.C))/(exp(p.D-p.C)+exp(p.C-p.C)+exp(p.D3-p.C)+exp(p.E-p.C)+exp(p.F-p.C)+exp(p.G-p.C)+exp(p.M-p.C)+exp(p.N-p.C)+exp(p.T-p.C)+exp(p.X1-p.C)+exp(p.X10-p.C)+exp(p.X11-p.C))
post.X11 <- (exp(p.X11-p.C))/(exp(p.D-p.C)+exp(p.C-p.C)+exp(p.D3-p.C)+exp(p.E-p.C)+exp(p.F-p.C)+exp(p.G-p.C)+exp(p.M-p.C)+exp(p.N-p.C)+exp(p.T-p.C)+exp(p.X1-p.C)+exp(p.X10-p.C)+exp(p.X11-p.C))
berneyi.posteriors <- as.matrix(c(post.C, post.D, post.D3, post.E, post.F, post.G, post.M, post.N, post.T, post.X1, post.X10, post.X11))
rownames(berneyi.posteriors) <- c("C", "D", "D3", "E", "F", "G", "M", "N", "T", "X1", "X10", "X11")
colnames(berneyi.posteriors) <- "berneyi.posteriors"
berneyi.posteriors <- round(berneyi.posteriors, digits=3)
berneyi.posteriors
## berneyi.posteriors
## C 0.000
## D 0.877
## D3 0.036
## E 0.000
## F 0.000
## G 0.001
## M 0.000
## N 0.084
## T 0.000
## X1 0.002
## X10 0.000
## X11 0.000
#typicality probability
d2.C <- (t(as.vector(berneyi)-mean.C))%*%solve(cov.d)%*%(as.vector(berneyi)-mean.C)
typicality.C <- pchisq(d2.C, df = 14, lower.tail = FALSE)
d2.D <- (t(as.vector(berneyi)-mean.D))%*%solve(cov.d)%*%(as.vector(berneyi)-mean.D)
typicality.D <- pchisq(d2.D, df = 14, lower.tail = FALSE)
d2.D3 <- (t(as.vector(berneyi)-mean.D3))%*%solve(cov.d)%*%(as.vector(berneyi)-mean.D3)
typicality.D3 <- pchisq(d2.D3, df = 14, lower.tail = FALSE)
d2.E <- (t(as.vector(berneyi)-mean.E))%*%solve(cov.d)%*%(as.vector(berneyi)-mean.E)
typicality.E <- pchisq(d2.E, df = 14, lower.tail = FALSE)
d2.F <- (t(as.vector(berneyi)-mean.F))%*%solve(cov.d)%*%(as.vector(berneyi)-mean.F)
typicality.F <- pchisq(d2.F, df = 14, lower.tail = FALSE)
d2.G <- (t(as.vector(berneyi)-mean.G))%*%solve(cov.d)%*%(as.vector(berneyi)-mean.G)
typicality.G <- pchisq(d2.G, df = 14, lower.tail = FALSE)
d2.M <- (t(as.vector(berneyi)-mean.M))%*%solve(cov.d)%*%(as.vector(berneyi)-mean.M)
typicality.M <- pchisq(d2.M, df = 14, lower.tail = FALSE)
d2.N <- (t(as.vector(berneyi)-mean.N))%*%solve(cov.d)%*%(as.vector(berneyi)-mean.N)
typicality.N <- pchisq(d2.N, df = 14, lower.tail = FALSE)
d2.T <- (t(as.vector(berneyi)-mean.T))%*%solve(cov.d)%*%(as.vector(berneyi)-mean.T)
typicality.T <- pchisq(d2.T, df = 14, lower.tail = FALSE)
d2.X1 <- (t(as.vector(berneyi)-mean.X1))%*%solve(cov.d)%*%(as.vector(berneyi)-mean.X1)
typicality.X1 <- pchisq(d2.X1, df = 14, lower.tail = FALSE)
d2.X10 <- (t(as.vector(berneyi)-mean.X10))%*%solve(cov.d)%*%(as.vector(berneyi)-mean.X10)
typicality.X10 <- pchisq(d2.X10, df = 14, lower.tail = FALSE)
d2.X11 <- (t(as.vector(berneyi)-mean.X11))%*%solve(cov.d)%*%(as.vector(berneyi)-mean.X11)
typicality.X11 <- pchisq(d2.X11, df = 14, lower.tail = FALSE)
berneyi.typicality <- as.matrix(c(typicality.C, typicality.D, typicality.D3, typicality.E, typicality.F, typicality.G, typicality.M, typicality.N, typicality.T, typicality.X1, typicality.X10, typicality.X11))
rownames(berneyi.typicality) <- c("C", "D", "D3", "E", "F", "G", "M", "N", "T", "X1", "X10", "X11")
colnames(berneyi.typicality) <- "berneyi.typicality"
berneyi.typicality <- round(berneyi.typicality, digits=6)
berneyi.typicality
## berneyi.typicality
## C 0.000000
## D 0.002515
## D3 0.000994
## E 0.000000
## F 0.000021
## G 0.000052
## M 0.000000
## N 0.000363
## T 0.000000
## X1 0.000065
## X10 0.000000
## X11 0.000000
The type specimen of Ozestheria berneyi can be assigned to D (probability 87.7%) or N (8.4%), it is not typical of M and should be considered an outlier shape of O. berneyi.
### 9 Classify specimen to species
rufa <- colMeans(shape_8[c(2:3), c(2:15)]) #new specimen to classify
# get classification score
p.C <- rufa%*%cj.C+cj0.C+log(All.lda$prior[1])
p.D <- rufa%*%cj.D+cj0.D+log(All.lda$prior[2])
p.D3 <- rufa%*%cj.D3+cj0.D3+log(All.lda$prior[3])
p.E <- rufa%*%cj.E+cj0.E+log(All.lda$prior[4])
p.F <- rufa%*%cj.F+cj0.F+log(All.lda$prior[5])
p.G <- rufa%*%cj.G+cj0.G+log(All.lda$prior[6])
p.M <- rufa%*%cj.M+cj0.M+log(All.lda$prior[7])
p.N <- rufa%*%cj.N+cj0.N+log(All.lda$prior[8])
p.T <- rufa%*%cj.T+cj0.T+log(All.lda$prior[9])
p.X1 <- rufa%*%cj.X1+cj0.X1+log(All.lda$prior[10])
p.X10 <- rufa%*%cj.X10+cj0.X10+log(All.lda$prior[11])
p.X11 <- rufa%*%cj.X11+cj0.X11+log(All.lda$prior[12])
# posterior probability
post.C <- (exp(p.C-p.C))/(exp(p.D-p.C)+exp(p.C-p.C)+exp(p.D3-p.C)+exp(p.E-p.C)+exp(p.F-p.C)+exp(p.G-p.C)+exp(p.M-p.C)+exp(p.N-p.C)+exp(p.T-p.C)+exp(p.X1-p.C)+exp(p.X10-p.C)+exp(p.X11-p.C))
post.D <- (exp(p.D-p.C))/(exp(p.D-p.C)+exp(p.C-p.C)+exp(p.D3-p.C)+exp(p.E-p.C)+exp(p.F-p.C)+exp(p.G-p.C)+exp(p.M-p.C)+exp(p.N-p.C)+exp(p.T-p.C)+exp(p.X1-p.C)+exp(p.X10-p.C)+exp(p.X11-p.C))
post.D3 <- (exp(p.D3-p.C))/(exp(p.D-p.C)+exp(p.C-p.C)+exp(p.D3-p.C)+exp(p.E-p.C)+exp(p.F-p.C)+exp(p.G-p.C)+exp(p.M-p.C)+exp(p.N-p.C)+exp(p.T-p.C)+exp(p.X1-p.C)+exp(p.X10-p.C)+exp(p.X11-p.C))
post.E <- (exp(p.E-p.C))/(exp(p.D-p.C)+exp(p.C-p.C)+exp(p.D3-p.C)+exp(p.E-p.C)+exp(p.F-p.C)+exp(p.G-p.C)+exp(p.M-p.C)+exp(p.N-p.C)+exp(p.T-p.C)+exp(p.X1-p.C)+exp(p.X10-p.C)+exp(p.X11-p.C))
post.F <- (exp(p.F-p.C))/(exp(p.D-p.C)+exp(p.C-p.C)+exp(p.D3-p.C)+exp(p.E-p.C)+exp(p.F-p.C)+exp(p.G-p.C)+exp(p.M-p.C)+exp(p.N-p.C)+exp(p.T-p.C)+exp(p.X1-p.C)+exp(p.X10-p.C)+exp(p.X11-p.C))
post.G <- (exp(p.G-p.C))/(exp(p.D-p.C)+exp(p.C-p.C)+exp(p.D3-p.C)+exp(p.E-p.C)+exp(p.F-p.C)+exp(p.G-p.C)+exp(p.M-p.C)+exp(p.N-p.C)+exp(p.T-p.C)+exp(p.X1-p.C)+exp(p.X10-p.C)+exp(p.X11-p.C))
post.M <- (exp(p.M-p.C))/(exp(p.D-p.C)+exp(p.C-p.C)+exp(p.D3-p.C)+exp(p.E-p.C)+exp(p.F-p.C)+exp(p.G-p.C)+exp(p.M-p.C)+exp(p.N-p.C)+exp(p.T-p.C)+exp(p.X1-p.C)+exp(p.X10-p.C)+exp(p.X11-p.C))
post.N <- (exp(p.N-p.C))/(exp(p.D-p.C)+exp(p.C-p.C)+exp(p.D3-p.C)+exp(p.E-p.C)+exp(p.F-p.C)+exp(p.G-p.C)+exp(p.M-p.C)+exp(p.N-p.C)+exp(p.T-p.C)+exp(p.X1-p.C)+exp(p.X10-p.C)+exp(p.X11-p.C))
post.T <- (exp(p.T-p.C))/(exp(p.D-p.C)+exp(p.C-p.C)+exp(p.D3-p.C)+exp(p.E-p.C)+exp(p.F-p.C)+exp(p.G-p.C)+exp(p.M-p.C)+exp(p.N-p.C)+exp(p.T-p.C)+exp(p.X1-p.C)+exp(p.X10-p.C)+exp(p.X11-p.C))
post.X1 <- (exp(p.X1-p.C))/(exp(p.D-p.C)+exp(p.C-p.C)+exp(p.D3-p.C)+exp(p.E-p.C)+exp(p.F-p.C)+exp(p.G-p.C)+exp(p.M-p.C)+exp(p.N-p.C)+exp(p.T-p.C)+exp(p.X1-p.C)+exp(p.X10-p.C)+exp(p.X11-p.C))
post.X10 <- (exp(p.X10-p.C))/(exp(p.D-p.C)+exp(p.C-p.C)+exp(p.D3-p.C)+exp(p.E-p.C)+exp(p.F-p.C)+exp(p.G-p.C)+exp(p.M-p.C)+exp(p.N-p.C)+exp(p.T-p.C)+exp(p.X1-p.C)+exp(p.X10-p.C)+exp(p.X11-p.C))
post.X11 <- (exp(p.X11-p.C))/(exp(p.D-p.C)+exp(p.C-p.C)+exp(p.D3-p.C)+exp(p.E-p.C)+exp(p.F-p.C)+exp(p.G-p.C)+exp(p.M-p.C)+exp(p.N-p.C)+exp(p.T-p.C)+exp(p.X1-p.C)+exp(p.X10-p.C)+exp(p.X11-p.C))
rufa.posteriors <- as.matrix(c(post.C, post.D, post.D3, post.E, post.F, post.G, post.M, post.N, post.T, post.X1, post.X10, post.X11))
rownames(rufa.posteriors) <- c("C", "D", "D3", "E", "F", "G", "M", "N", "T", "X1", "X10", "X11")
colnames(rufa.posteriors) <- "rufa.posteriors"
rufa.posteriors <- round(rufa.posteriors, digits=3)
rufa.posteriors
## rufa.posteriors
## C 0
## D 0
## D3 0
## E 0
## F 0
## G 0
## M 0
## N 0
## T 0
## X1 0
## X10 1
## X11 0
#typicality probability
d2.C <- (t(as.vector(rufa)-mean.C))%*%solve(cov.d)%*%(as.vector(rufa)-mean.C)
typicality.C <- pchisq(d2.C, df = 14, lower.tail = FALSE)
d2.D <- (t(as.vector(rufa)-mean.D))%*%solve(cov.d)%*%(as.vector(rufa)-mean.D)
typicality.D <- pchisq(d2.D, df = 14, lower.tail = FALSE)
d2.D3 <- (t(as.vector(rufa)-mean.D3))%*%solve(cov.d)%*%(as.vector(rufa)-mean.D3)
typicality.D3 <- pchisq(d2.D3, df = 14, lower.tail = FALSE)
d2.E <- (t(as.vector(rufa)-mean.E))%*%solve(cov.d)%*%(as.vector(rufa)-mean.E)
typicality.E <- pchisq(d2.E, df = 14, lower.tail = FALSE)
d2.F <- (t(as.vector(rufa)-mean.F))%*%solve(cov.d)%*%(as.vector(rufa)-mean.F)
typicality.F <- pchisq(d2.F, df = 14, lower.tail = FALSE)
d2.G <- (t(as.vector(rufa)-mean.G))%*%solve(cov.d)%*%(as.vector(rufa)-mean.G)
typicality.G <- pchisq(d2.G, df = 14, lower.tail = FALSE)
d2.M <- (t(as.vector(rufa)-mean.M))%*%solve(cov.d)%*%(as.vector(rufa)-mean.M)
typicality.M <- pchisq(d2.M, df = 14, lower.tail = FALSE)
d2.N <- (t(as.vector(rufa)-mean.N))%*%solve(cov.d)%*%(as.vector(rufa)-mean.N)
typicality.N <- pchisq(d2.N, df = 14, lower.tail = FALSE)
d2.T <- (t(as.vector(rufa)-mean.T))%*%solve(cov.d)%*%(as.vector(rufa)-mean.T)
typicality.T <- pchisq(d2.T, df = 14, lower.tail = FALSE)
d2.X1 <- (t(as.vector(rufa)-mean.X1))%*%solve(cov.d)%*%(as.vector(rufa)-mean.X1)
typicality.X1 <- pchisq(d2.X1, df = 14, lower.tail = FALSE)
d2.X10 <- (t(as.vector(rufa)-mean.X10))%*%solve(cov.d)%*%(as.vector(rufa)-mean.X10)
typicality.X10 <- pchisq(d2.X10, df = 14, lower.tail = FALSE)
d2.X11 <- (t(as.vector(rufa)-mean.X11))%*%solve(cov.d)%*%(as.vector(rufa)-mean.X11)
typicality.X11 <- pchisq(d2.X11, df = 14, lower.tail = FALSE)
rufa.typicality <- as.matrix(c(typicality.C, typicality.D, typicality.D3, typicality.E, typicality.F, typicality.G, typicality.M, typicality.N, typicality.T, typicality.X1, typicality.X10, typicality.X11))
rownames(rufa.typicality) <- c("C", "D", "D3", "E", "F", "G", "M", "N", "T", "X1", "X10", "X11")
colnames(rufa.typicality) <- "rufa.typicality"
rufa.typicality <- round(rufa.typicality, digits=6)
rufa.typicality
## rufa.typicality
## C 0.000000
## D 0.000000
## D3 0.000000
## E 0.000000
## F 0.000000
## G 0.000000
## M 0.000000
## N 0.000000
## T 0.000000
## X1 0.000000
## X10 0.042888
## X11 0.000000
The mean shape of the type specimens of Ozestheria rufa can be assigned to X10 (100%).
### 9 Classify specimen to species
sarsii <- shape_8[242, c(2:15)] #new specimen to classify
sarsii <- as.matrix(sarsii)
# get classification score
p.C <- sarsii%*%cj.C+cj0.C+log(All.lda$prior[1])
p.D <- sarsii%*%cj.D+cj0.D+log(All.lda$prior[2])
p.D3 <- sarsii%*%cj.D3+cj0.D3+log(All.lda$prior[3])
p.E <- sarsii%*%cj.E+cj0.E+log(All.lda$prior[4])
p.F <- sarsii%*%cj.F+cj0.F+log(All.lda$prior[5])
p.G <- sarsii%*%cj.G+cj0.G+log(All.lda$prior[6])
p.M <- sarsii%*%cj.M+cj0.M+log(All.lda$prior[7])
p.N <- sarsii%*%cj.N+cj0.N+log(All.lda$prior[8])
p.T <- sarsii%*%cj.T+cj0.T+log(All.lda$prior[9])
p.X1 <- sarsii%*%cj.X1+cj0.X1+log(All.lda$prior[10])
p.X10 <- sarsii%*%cj.X10+cj0.X10+log(All.lda$prior[11])
p.X11 <- sarsii%*%cj.X11+cj0.X11+log(All.lda$prior[12])
# posterior probability
post.C <- (exp(p.C-p.C))/(exp(p.D-p.C)+exp(p.C-p.C)+exp(p.D3-p.C)+exp(p.E-p.C)+exp(p.F-p.C)+exp(p.G-p.C)+exp(p.M-p.C)+exp(p.N-p.C)+exp(p.T-p.C)+exp(p.X1-p.C)+exp(p.X10-p.C)+exp(p.X11-p.C))
post.D <- (exp(p.D-p.C))/(exp(p.D-p.C)+exp(p.C-p.C)+exp(p.D3-p.C)+exp(p.E-p.C)+exp(p.F-p.C)+exp(p.G-p.C)+exp(p.M-p.C)+exp(p.N-p.C)+exp(p.T-p.C)+exp(p.X1-p.C)+exp(p.X10-p.C)+exp(p.X11-p.C))
post.D3 <- (exp(p.D3-p.C))/(exp(p.D-p.C)+exp(p.C-p.C)+exp(p.D3-p.C)+exp(p.E-p.C)+exp(p.F-p.C)+exp(p.G-p.C)+exp(p.M-p.C)+exp(p.N-p.C)+exp(p.T-p.C)+exp(p.X1-p.C)+exp(p.X10-p.C)+exp(p.X11-p.C))
post.E <- (exp(p.E-p.C))/(exp(p.D-p.C)+exp(p.C-p.C)+exp(p.D3-p.C)+exp(p.E-p.C)+exp(p.F-p.C)+exp(p.G-p.C)+exp(p.M-p.C)+exp(p.N-p.C)+exp(p.T-p.C)+exp(p.X1-p.C)+exp(p.X10-p.C)+exp(p.X11-p.C))
post.F <- (exp(p.F-p.C))/(exp(p.D-p.C)+exp(p.C-p.C)+exp(p.D3-p.C)+exp(p.E-p.C)+exp(p.F-p.C)+exp(p.G-p.C)+exp(p.M-p.C)+exp(p.N-p.C)+exp(p.T-p.C)+exp(p.X1-p.C)+exp(p.X10-p.C)+exp(p.X11-p.C))
post.G <- (exp(p.G-p.C))/(exp(p.D-p.C)+exp(p.C-p.C)+exp(p.D3-p.C)+exp(p.E-p.C)+exp(p.F-p.C)+exp(p.G-p.C)+exp(p.M-p.C)+exp(p.N-p.C)+exp(p.T-p.C)+exp(p.X1-p.C)+exp(p.X10-p.C)+exp(p.X11-p.C))
post.M <- (exp(p.M-p.C))/(exp(p.D-p.C)+exp(p.C-p.C)+exp(p.D3-p.C)+exp(p.E-p.C)+exp(p.F-p.C)+exp(p.G-p.C)+exp(p.M-p.C)+exp(p.N-p.C)+exp(p.T-p.C)+exp(p.X1-p.C)+exp(p.X10-p.C)+exp(p.X11-p.C))
post.N <- (exp(p.N-p.C))/(exp(p.D-p.C)+exp(p.C-p.C)+exp(p.D3-p.C)+exp(p.E-p.C)+exp(p.F-p.C)+exp(p.G-p.C)+exp(p.M-p.C)+exp(p.N-p.C)+exp(p.T-p.C)+exp(p.X1-p.C)+exp(p.X10-p.C)+exp(p.X11-p.C))
post.T <- (exp(p.T-p.C))/(exp(p.D-p.C)+exp(p.C-p.C)+exp(p.D3-p.C)+exp(p.E-p.C)+exp(p.F-p.C)+exp(p.G-p.C)+exp(p.M-p.C)+exp(p.N-p.C)+exp(p.T-p.C)+exp(p.X1-p.C)+exp(p.X10-p.C)+exp(p.X11-p.C))
post.X1 <- (exp(p.X1-p.C))/(exp(p.D-p.C)+exp(p.C-p.C)+exp(p.D3-p.C)+exp(p.E-p.C)+exp(p.F-p.C)+exp(p.G-p.C)+exp(p.M-p.C)+exp(p.N-p.C)+exp(p.T-p.C)+exp(p.X1-p.C)+exp(p.X10-p.C)+exp(p.X11-p.C))
post.X10 <- (exp(p.X10-p.C))/(exp(p.D-p.C)+exp(p.C-p.C)+exp(p.D3-p.C)+exp(p.E-p.C)+exp(p.F-p.C)+exp(p.G-p.C)+exp(p.M-p.C)+exp(p.N-p.C)+exp(p.T-p.C)+exp(p.X1-p.C)+exp(p.X10-p.C)+exp(p.X11-p.C))
post.X11 <- (exp(p.X11-p.C))/(exp(p.D-p.C)+exp(p.C-p.C)+exp(p.D3-p.C)+exp(p.E-p.C)+exp(p.F-p.C)+exp(p.G-p.C)+exp(p.M-p.C)+exp(p.N-p.C)+exp(p.T-p.C)+exp(p.X1-p.C)+exp(p.X10-p.C)+exp(p.X11-p.C))
sarsii.posteriors <- as.matrix(c(post.C, post.D, post.D3, post.E, post.F, post.G, post.M, post.N, post.T, post.X1, post.X10, post.X11))
rownames(sarsii.posteriors) <- c("C", "D", "D3", "E", "F", "G", "M", "N", "T", "X1", "X10", "X11")
colnames(sarsii.posteriors) <- "sarsii.posteriors"
sarsii.posteriors <- round(sarsii.posteriors, digits=3)
sarsii.posteriors
## sarsii.posteriors
## C 0.000
## D 0.000
## D3 0.000
## E 0.000
## F 0.000
## G 0.000
## M 0.000
## N 0.000
## T 0.027
## X1 0.000
## X10 0.973
## X11 0.000
#typicality probability
d2.C <- (t(as.vector(sarsii)-mean.C))%*%solve(cov.d)%*%(as.vector(sarsii)-mean.C)
typicality.C <- pchisq(d2.C, df = 14, lower.tail = FALSE)
d2.D <- (t(as.vector(sarsii)-mean.D))%*%solve(cov.d)%*%(as.vector(sarsii)-mean.D)
typicality.D <- pchisq(d2.D, df = 14, lower.tail = FALSE)
d2.D3 <- (t(as.vector(sarsii)-mean.D3))%*%solve(cov.d)%*%(as.vector(sarsii)-mean.D3)
typicality.D3 <- pchisq(d2.D3, df = 14, lower.tail = FALSE)
d2.E <- (t(as.vector(sarsii)-mean.E))%*%solve(cov.d)%*%(as.vector(sarsii)-mean.E)
typicality.E <- pchisq(d2.E, df = 14, lower.tail = FALSE)
d2.F <- (t(as.vector(sarsii)-mean.F))%*%solve(cov.d)%*%(as.vector(sarsii)-mean.F)
typicality.F <- pchisq(d2.F, df = 14, lower.tail = FALSE)
d2.G <- (t(as.vector(sarsii)-mean.G))%*%solve(cov.d)%*%(as.vector(sarsii)-mean.G)
typicality.G <- pchisq(d2.G, df = 14, lower.tail = FALSE)
d2.M <- (t(as.vector(sarsii)-mean.M))%*%solve(cov.d)%*%(as.vector(sarsii)-mean.M)
typicality.M <- pchisq(d2.M, df = 14, lower.tail = FALSE)
d2.N <- (t(as.vector(sarsii)-mean.N))%*%solve(cov.d)%*%(as.vector(sarsii)-mean.N)
typicality.N <- pchisq(d2.N, df = 14, lower.tail = FALSE)
d2.T <- (t(as.vector(sarsii)-mean.T))%*%solve(cov.d)%*%(as.vector(sarsii)-mean.T)
typicality.T <- pchisq(d2.T, df = 14, lower.tail = FALSE)
d2.X1 <- (t(as.vector(sarsii)-mean.X1))%*%solve(cov.d)%*%(as.vector(sarsii)-mean.X1)
typicality.X1 <- pchisq(d2.X1, df = 14, lower.tail = FALSE)
d2.X10 <- (t(as.vector(sarsii)-mean.X10))%*%solve(cov.d)%*%(as.vector(sarsii)-mean.X10)
typicality.X10 <- pchisq(d2.X10, df = 14, lower.tail = FALSE)
d2.X11 <- (t(as.vector(sarsii)-mean.X11))%*%solve(cov.d)%*%(as.vector(sarsii)-mean.X11)
typicality.X11 <- pchisq(d2.X11, df = 14, lower.tail = FALSE)
sarsii.typicality <- as.matrix(c(typicality.C, typicality.D, typicality.D3, typicality.E, typicality.F, typicality.G, typicality.M, typicality.N, typicality.T, typicality.X1, typicality.X10, typicality.X11))
rownames(sarsii.typicality) <- c("C", "D", "D3", "E", "F", "G", "M", "N", "T", "X1", "X10", "X11")
colnames(sarsii.typicality) <- "sarsii.typicality"
sarsii.typicality <- round(sarsii.typicality, digits=6)
sarsii.typicality
## sarsii.typicality
## C 0.000000
## D 0.000000
## D3 0.000000
## E 0.000000
## F 0.000000
## G 0.000000
## M 0.000000
## N 0.000000
## T 0.002529
## X1 0.000000
## X10 0.020235
## X11 0.000000
The shape of Ozestheria sarsii is most similar to X10, with some probability of O. sarsii belonging to T.
### 9 Classify specimen to species
pellucida <- shape_8[249, c(2:15)] #new specimen to classify
pellucida <- as.matrix(pellucida)
# get classification score
p.C <- pellucida%*%cj.C+cj0.C+log(All.lda$prior[1])
p.D <- pellucida%*%cj.D+cj0.D+log(All.lda$prior[2])
p.D3 <- pellucida%*%cj.D3+cj0.D3+log(All.lda$prior[3])
p.E <- pellucida%*%cj.E+cj0.E+log(All.lda$prior[4])
p.F <- pellucida%*%cj.F+cj0.F+log(All.lda$prior[5])
p.G <- pellucida%*%cj.G+cj0.G+log(All.lda$prior[6])
p.M <- pellucida%*%cj.M+cj0.M+log(All.lda$prior[7])
p.N <- pellucida%*%cj.N+cj0.N+log(All.lda$prior[8])
p.T <- pellucida%*%cj.T+cj0.T+log(All.lda$prior[9])
p.X1 <- pellucida%*%cj.X1+cj0.X1+log(All.lda$prior[10])
p.X10 <- pellucida%*%cj.X10+cj0.X10+log(All.lda$prior[11])
p.X11 <- pellucida%*%cj.X11+cj0.X11+log(All.lda$prior[12])
# posterior probability
post.C <- (exp(p.C-p.C))/(exp(p.D-p.C)+exp(p.C-p.C)+exp(p.D3-p.C)+exp(p.E-p.C)+exp(p.F-p.C)+exp(p.G-p.C)+exp(p.M-p.C)+exp(p.N-p.C)+exp(p.T-p.C)+exp(p.X1-p.C)+exp(p.X10-p.C)+exp(p.X11-p.C))
post.D <- (exp(p.D-p.C))/(exp(p.D-p.C)+exp(p.C-p.C)+exp(p.D3-p.C)+exp(p.E-p.C)+exp(p.F-p.C)+exp(p.G-p.C)+exp(p.M-p.C)+exp(p.N-p.C)+exp(p.T-p.C)+exp(p.X1-p.C)+exp(p.X10-p.C)+exp(p.X11-p.C))
post.D3 <- (exp(p.D3-p.C))/(exp(p.D-p.C)+exp(p.C-p.C)+exp(p.D3-p.C)+exp(p.E-p.C)+exp(p.F-p.C)+exp(p.G-p.C)+exp(p.M-p.C)+exp(p.N-p.C)+exp(p.T-p.C)+exp(p.X1-p.C)+exp(p.X10-p.C)+exp(p.X11-p.C))
post.E <- (exp(p.E-p.C))/(exp(p.D-p.C)+exp(p.C-p.C)+exp(p.D3-p.C)+exp(p.E-p.C)+exp(p.F-p.C)+exp(p.G-p.C)+exp(p.M-p.C)+exp(p.N-p.C)+exp(p.T-p.C)+exp(p.X1-p.C)+exp(p.X10-p.C)+exp(p.X11-p.C))
post.F <- (exp(p.F-p.C))/(exp(p.D-p.C)+exp(p.C-p.C)+exp(p.D3-p.C)+exp(p.E-p.C)+exp(p.F-p.C)+exp(p.G-p.C)+exp(p.M-p.C)+exp(p.N-p.C)+exp(p.T-p.C)+exp(p.X1-p.C)+exp(p.X10-p.C)+exp(p.X11-p.C))
post.G <- (exp(p.G-p.C))/(exp(p.D-p.C)+exp(p.C-p.C)+exp(p.D3-p.C)+exp(p.E-p.C)+exp(p.F-p.C)+exp(p.G-p.C)+exp(p.M-p.C)+exp(p.N-p.C)+exp(p.T-p.C)+exp(p.X1-p.C)+exp(p.X10-p.C)+exp(p.X11-p.C))
post.M <- (exp(p.M-p.C))/(exp(p.D-p.C)+exp(p.C-p.C)+exp(p.D3-p.C)+exp(p.E-p.C)+exp(p.F-p.C)+exp(p.G-p.C)+exp(p.M-p.C)+exp(p.N-p.C)+exp(p.T-p.C)+exp(p.X1-p.C)+exp(p.X10-p.C)+exp(p.X11-p.C))
post.N <- (exp(p.N-p.C))/(exp(p.D-p.C)+exp(p.C-p.C)+exp(p.D3-p.C)+exp(p.E-p.C)+exp(p.F-p.C)+exp(p.G-p.C)+exp(p.M-p.C)+exp(p.N-p.C)+exp(p.T-p.C)+exp(p.X1-p.C)+exp(p.X10-p.C)+exp(p.X11-p.C))
post.T <- (exp(p.T-p.C))/(exp(p.D-p.C)+exp(p.C-p.C)+exp(p.D3-p.C)+exp(p.E-p.C)+exp(p.F-p.C)+exp(p.G-p.C)+exp(p.M-p.C)+exp(p.N-p.C)+exp(p.T-p.C)+exp(p.X1-p.C)+exp(p.X10-p.C)+exp(p.X11-p.C))
post.X1 <- (exp(p.X1-p.C))/(exp(p.D-p.C)+exp(p.C-p.C)+exp(p.D3-p.C)+exp(p.E-p.C)+exp(p.F-p.C)+exp(p.G-p.C)+exp(p.M-p.C)+exp(p.N-p.C)+exp(p.T-p.C)+exp(p.X1-p.C)+exp(p.X10-p.C)+exp(p.X11-p.C))
post.X10 <- (exp(p.X10-p.C))/(exp(p.D-p.C)+exp(p.C-p.C)+exp(p.D3-p.C)+exp(p.E-p.C)+exp(p.F-p.C)+exp(p.G-p.C)+exp(p.M-p.C)+exp(p.N-p.C)+exp(p.T-p.C)+exp(p.X1-p.C)+exp(p.X10-p.C)+exp(p.X11-p.C))
post.X11 <- (exp(p.X11-p.C))/(exp(p.D-p.C)+exp(p.C-p.C)+exp(p.D3-p.C)+exp(p.E-p.C)+exp(p.F-p.C)+exp(p.G-p.C)+exp(p.M-p.C)+exp(p.N-p.C)+exp(p.T-p.C)+exp(p.X1-p.C)+exp(p.X10-p.C)+exp(p.X11-p.C))
pellucida.posteriors <- as.matrix(c(post.C, post.D, post.D3, post.E, post.F, post.G, post.M, post.N, post.T, post.X1, post.X10, post.X11))
rownames(pellucida.posteriors) <- c("C", "D", "D3", "E", "F", "G", "M", "N", "T", "X1", "X10", "X11")
colnames(pellucida.posteriors) <- "pellucida.posteriors"
pellucida.posteriors <- round(pellucida.posteriors, digits=3)
pellucida.posteriors
## pellucida.posteriors
## C 0.000
## D 0.000
## D3 0.000
## E 0.013
## F 0.000
## G 0.000
## M 0.060
## N 0.000
## T 0.000
## X1 0.000
## X10 0.926
## X11 0.000
#typicality probability
d2.C <- (t(as.vector(pellucida)-mean.C))%*%solve(cov.d)%*%(as.vector(pellucida)-mean.C)
typicality.C <- pchisq(d2.C, df = 14, lower.tail = FALSE)
d2.D <- (t(as.vector(pellucida)-mean.D))%*%solve(cov.d)%*%(as.vector(pellucida)-mean.D)
typicality.D <- pchisq(d2.D, df = 14, lower.tail = FALSE)
d2.D3 <- (t(as.vector(pellucida)-mean.D3))%*%solve(cov.d)%*%(as.vector(pellucida)-mean.D3)
typicality.D3 <- pchisq(d2.D3, df = 14, lower.tail = FALSE)
d2.E <- (t(as.vector(pellucida)-mean.E))%*%solve(cov.d)%*%(as.vector(pellucida)-mean.E)
typicality.E <- pchisq(d2.E, df = 14, lower.tail = FALSE)
d2.F <- (t(as.vector(pellucida)-mean.F))%*%solve(cov.d)%*%(as.vector(pellucida)-mean.F)
typicality.F <- pchisq(d2.F, df = 14, lower.tail = FALSE)
d2.G <- (t(as.vector(pellucida)-mean.G))%*%solve(cov.d)%*%(as.vector(pellucida)-mean.G)
typicality.G <- pchisq(d2.G, df = 14, lower.tail = FALSE)
d2.M <- (t(as.vector(pellucida)-mean.M))%*%solve(cov.d)%*%(as.vector(pellucida)-mean.M)
typicality.M <- pchisq(d2.M, df = 14, lower.tail = FALSE)
d2.N <- (t(as.vector(pellucida)-mean.N))%*%solve(cov.d)%*%(as.vector(pellucida)-mean.N)
typicality.N <- pchisq(d2.N, df = 14, lower.tail = FALSE)
d2.T <- (t(as.vector(pellucida)-mean.T))%*%solve(cov.d)%*%(as.vector(pellucida)-mean.T)
typicality.T <- pchisq(d2.T, df = 14, lower.tail = FALSE)
d2.X1 <- (t(as.vector(pellucida)-mean.X1))%*%solve(cov.d)%*%(as.vector(pellucida)-mean.X1)
typicality.X1 <- pchisq(d2.X1, df = 14, lower.tail = FALSE)
d2.X10 <- (t(as.vector(pellucida)-mean.X10))%*%solve(cov.d)%*%(as.vector(pellucida)-mean.X10)
typicality.X10 <- pchisq(d2.X10, df = 14, lower.tail = FALSE)
d2.X11 <- (t(as.vector(pellucida)-mean.X11))%*%solve(cov.d)%*%(as.vector(pellucida)-mean.X11)
typicality.X11 <- pchisq(d2.X11, df = 14, lower.tail = FALSE)
pellucida.typicality <- as.matrix(c(typicality.C, typicality.D, typicality.D3, typicality.E, typicality.F, typicality.G, typicality.M, typicality.N, typicality.T, typicality.X1, typicality.X10, typicality.X11))
rownames(pellucida.typicality) <- c("C", "D", "D3", "E", "F", "G", "M", "N", "T", "X1", "X10", "X11")
colnames(pellucida.typicality) <- "pellucida.typicality"
pellucida.typicality <- round(pellucida.typicality, digits=6)
pellucida.typicality
## pellucida.typicality
## C 0.000000
## D 0.000000
## D3 0.000000
## E 0.000008
## F 0.000000
## G 0.000000
## M 0.000012
## N 0.000000
## T 0.000001
## X1 0.000000
## X10 0.000402
## X11 0.000000
The shape of the type specimen of Ozestheria pellucida is most similar to but not typical of X10, indicating that none of the examined lineages can be assigned to O. pellucida.