# NOT RUN {
# Data matrix of 2D landmark coordinates
data("Tropheus.IK.coord")
coords <- which(names(Tropheus.IK.coord) == "X1"):which(names(Tropheus.IK.coord) == "Y19")
proc.coord <- as.matrix(Tropheus.IK.coord[coords])
# Covariance matrix of each population
S.phen.pop <- cov.group(proc.coord, groups = Tropheus.IK.coord$POP.ID)
# Pseudo-inversion of a square matrix (covariance matrix of the population IKS5)
S2 <- S.phen.pop[, , "IKS5"]
invS2 <- minv(S2, method = 0, pa = 0) # Pseudoinverse keeping non-zero eigenvalues
invS2 <- minv(S2, method = 1, pa = 10^-8) # Pseudoinverse keeping eigenvalues above 10^-8
invS2 <- minv(S2, method = 2, pa = 5) # Pseudoinverse keeping the first five eigenvalues
invS2 <- minv(S2, method = 3, pa = 0.5) # Ridge regression with Tikhonov factor of 0.5
# }
Run the code above in your browser using DataLab