ImputeRandom
imputes missing values with the Q ancestry coeficient matrix and G ancestral
frequencies estimates. Missing values are sampled with the estimated genotype
frequencies (P = Q G^T).
ImputeRound
imputes missing values with the Q ancestry coeficient matrix and G ancestral
frequencies estimates. Missing values are computed as a round of estimated genotype
frequencies (P = Q G^T).
ImputeRandom(tess3.res, masked.X) ImputeRound(tess3.res, masked.X)
tess3.res | tess3Main object with Q and G estimates. |
---|---|
masked.X | Genotype matrix with the missing values (NA values). |
the imputed genotype matrix.
library(tess3r) n <- 100 K <- 3 ploidy <- 2 L <- 3001 data.list <- SampleGenoFromGenerativeModelTESS3(G = SampleUnifDirichletG(L, ploidy, K), Q = SampleUnifQ(n, K), coord = SampleNormalClusterCoord(n.by.pop = n, K = 1), ploidy = ploidy) # mask data set.seed(0) masked.prop <- 0.1 masked.X <- data.list$X masked.X[sample(1:(ncol(masked.X)*nrow(masked.X)), (ncol(masked.X)*nrow(masked.X)) * masked.prop)] <- NA # run tess3 tess3.obj <- tess3(X = masked.X, coord = data.list$coord, K = 3, ploidy = 2, lambda = 1.0, method = "projected.ls", rep = 2)#> == Computing spectral decomposition of graph laplacian matrix: done #> ==Main loop with 1 threads: done #> == Computing spectral decomposition of graph laplacian matrix: done #> ==Main loop with 1 threads: doneimputed.X.random <- ImputeRandom(Gettess3res(tess3.obj,3), masked.X) mean(data.list$X[is.na(masked.X)] != imputed.X.random[is.na(masked.X)]) # pourcentage of error#> [1] 0.4898034imputed.X.round <- ImputeRound(tess3.res = Gettess3res(tess3.obj,3), masked.X) mean(data.list$X[is.na(masked.X)] != imputed.X.round[is.na(masked.X)]) # pourcentage of error#> [1] 0.5771743