}
i = 1
fold_genotypes <- unlist(genotypes) # Decompose the matrix to simplify cross-validation index reference
orig_genotypes <- fold_genotypes[folds$subsets[folds$which == i]] # Save the original genotypes
fold_genotypes[folds$subsets[folds$which == i]] <- NA # Set the values to missing
fold_genotypes <- matrix(fold_genotypes, ncol = ncol(genotypes), nrow = nrow(genotypes))
View(fold_genotypes)
View(fold_genotypes[1:10, 1:10])
genotypes <- data.frame(read.table("mdp_numeric.txt", header = T, row.names = 1, colClasses = classes, stringsAsFactors = F, sep = "\t"))
for (i in 1:10)
{
fold_genotypes <- unlist(genotypes) # Decompose the matrix to simplify cross-validation index reference
orig_genotypes <- fold_genotypes[folds$subsets[folds$which == i]] # Save the original genotypes
fold_genotypes[folds$subsets[folds$which == i]] <- NA # Set the values to missing
fold_genotypes <- matrix(fold_genotypes, ncol = ncol(genotypes), nrow = nrow(genotypes))
fold_list <- list(fold_genotypes, orig_genotypes)
names(fold_list) <- c('fold_genotypes', 'orig_genotypes')
cv_genotype_list[[i]] <- fold_list
names(cv_genotype_list)[i] <- paste('fold_', i)
}
fold_ct = 10
cv_genotype_list <- list()
if (!is.null(fold_ct))
{
iterator <- 1:fold_ct
} else
{
iterator <- unique(folds$which)
}
fold_ct = NULL
if (!is.null(fold_ct))
{
iterator <- 1:fold_ct
} else
{
iterator <- unique(folds$which)
}
x = genotypes[,1]
table(x)
min(table(x))
allele_freq1 <- (sum(x == 0)*2 + sum(x == 1)) / (sum(!is.na(x)) * 2)
allele_freq2 <- (sum(x == 2)*2 + sum(x == 1)) / (sum(!is.na(x)) * 2)
allele_freq1 + allele_freq2
min(allele_freq1, allele_freq2)
# Check marker minor allele frequencies
minor_allele_freq <- apply(genotypes, 1, function(x)
{
allele_freq1 <- (sum(x == 0)*2 + sum(x == 1)) / (sum(!is.na(x)) * 2)
allele_freq2 <- (sum(x == 2)*2 + sum(x == 1)) / (sum(!is.na(x)) * 2)
return(min(allele_freq1, allele_freq2))
})
qplot(minor_allele_freq)
qplot(minor_allele_freq, bins = 50)
qplot(minor_allele_freq, bins = 30)
x = genotypes[,1]
allele_freq1 <- (sum(x == 0)*2 + sum(x == 1)) / (sum(!is.na(x)) * 2)
allele_freq2 <- (sum(x == 2)*2 + sum(x == 1)) / (sum(!is.na(x)) * 2)
min(allele_freq1, allele_freq2)
# Check marker minor allele frequencies
minor_allele_freq <- apply(genotypes, 2, function(x)
{
allele_freq1 <- (sum(x == 0)*2 + sum(x == 1)) / (sum(!is.na(x)) * 2)
allele_freq2 <- (sum(x == 2)*2 + sum(x == 1)) / (sum(!is.na(x)) * 2)
return(min(allele_freq1, allele_freq2))
})
# Plot the minor allele frequency
qplot(minor_allele_freq) +
labs(x = 'Minor Allele Frequency', y = "Number of Genes", title = 'Histogram of minor allele frequency')
# Plot the minor allele frequency
qplot(minor_allele_freq, bins = 50) +
labs(x = 'Minor Allele Frequency', y = "Number of Genes", title = 'Histogram of minor allele frequency')
sum(minor_allele_freq > 0.05)
# Filter out markers with maf <= 0.05
genotypes_maf_filt <- genotypes[,minor_allele_freq > 0.05]
marker_map <- read.table("mdp_SNP_information.txt", header = T, stringsAsFactors = F, sep = "\t", nrows = 1)
marker_map <- read.table("mdp_SNP_information.txt", header = T, stringsAsFactors = F, sep = "\t")
library(BLINK)
genotypes = "newdata.vcf"
outfile = "test_output"
# Set the working directory
setwd("C:/Users/mmcgo/Dropbox/CROPS545_Spring2020/Labs/lab3_4_imputation")
# Define the system command
command_prefix <- "java -Xmx1g -jar beagle.25Nov19.28d.jar"
command_args <- paste(" gt=", genotypes, " out=", outfile, sep = "")
command <- paste(command_prefix, command_args)
# Run BEAGLE using the system function
test <- system(command, intern = T, invisible = F)
# Run BEAGLE using the system function
test <- system(command, intern = T, invisible = F)
write.table(fold_list, quote = F, row.names = T, col.names = T, file = "mdp_numeric_na.txt")
write.table(fold_list[[1]][[1]], quote = F, row.names = T, col.names = T, file = "mdp_numeric_na.txt")
write.table(fold_list[1][[1]], quote = F, row.names = T, col.names = T, file = "mdp_numeric_na.txt")
# This function uses a cvFolds assignment to set matrix values to missing and retains the original values
gen_cv_sets <- function(folds, genotypes, fold_ct = NULL)
{
cv_genotype_list <- list()
if (!is.null(fold_ct))
{
iterator <- 1:fold_ct
} else
{
iterator <- unique(folds$which)
}
for (i in iterator)
{
fold_genotypes <- unlist(genotypes) # Decompose the matrix to simplify cross-validation index reference
orig_genotypes <- fold_genotypes[folds$subsets[folds$which == i]] # Save the original genotypes
fold_genotypes[folds$subsets[folds$which == i]] <- NA # Set the values to missing
fold_genotypes <- data.frame(matrix(fold_genotypes, ncol = ncol(genotypes), nrow = nrow(genotypes)))
names(fold_genotypes) <- names(genotypes)
row.names(fold_genotypes) <- row.names(genotypes)
fold_list <- list(fold_genotypes, orig_genotypes)
names(fold_list) <- c('fold_genotypes', 'orig_genotypes')
cv_genotype_list[[i]] <- fold_list
names(cv_genotype_list)[i] <- paste('fold_', i)
}
return(cv_genotype_list)
}
test <- gen_cv_sets(folds, genotypes, 10)
test <- gen_cv_sets(folds, genotypes, fold_ct = 10)
# This function uses a cvFolds assignment to set matrix values to missing and retains the original values
gen_cv_sets <- function(folds, genotypes, fold_ct = NULL)
{
cv_genotype_list <- list()
if (!is.null(fold_ct))
{
iterator <- 1:fold_ct
} else
{
iterator <- unique(folds$which)
}
for (i in iterator)
{
fold_genotypes <- unlist(genotypes) # Decompose the matrix to simplify cross-validation index reference
orig_genotypes <- fold_genotypes[folds$subsets[folds$which == i]] # Save the original genotypes
fold_genotypes[folds$subsets[folds$which == i]] <- NA # Set the values to missing
fold_genotypes <- data.frame(matrix(fold_genotypes, ncol = ncol(genotypes), nrow = nrow(genotypes)))
names(fold_genotypes) <- names(genotypes)
row.names(fold_genotypes) <- row.names(genotypes)
fold_list <- list(fold_genotypes, orig_genotypes)
names(fold_list) <- c('fold_genotypes', 'orig_genotypes')
cv_genotype_list[[i]] <- fold_list
names(cv_genotype_list)[i] <- paste('fold_', i)
}
return(cv_genotype_list)
}
test <- gen_cv_sets(folds, genotypes, fold_ct = 10)
# This function uses a cvFolds assignment to set matrix values to missing and retains the original values
gen_cv_sets <- function(folds, genotypes, fold_ct = NULL)
{
cv_genotype_list <- list()
if (!is.null(fold_ct))
{
iterator <- 1:fold_ct
} else
{
iterator <- unique(folds$which)
}
for (i in iterator)
{
fold_genotypes <- unlist(genotypes) # Decompose the matrix to simplify cross-validation index reference
orig_genotypes <- fold_genotypes[folds$subsets[folds$which == i]] # Save the original genotypes
fold_genotypes[folds$subsets[folds$which == i]] <- NA # Set the values to missing
fold_genotypes <- matrix(fold_genotypes, ncol = ncol(genotypes), nrow = nrow(genotypes))
names(fold_genotypes) <- names(genotypes)
row.names(fold_genotypes) <- row.names(genotypes)
fold_list <- list(fold_genotypes, orig_genotypes)
names(fold_list) <- c('fold_genotypes', 'orig_genotypes')
cv_genotype_list[[i]] <- fold_list
names(cv_genotype_list)[i] <- paste('fold_', i)
}
return(cv_genotype_list)
}
test <- gen_cv_sets(folds, genotypes, fold_ct = 10)
matrix(fold_genotypes, ncol = ncol(genotypes), nrow = nrow(genotypes))
fold_genotypes = NULL
# This function uses a cvFolds assignment to set matrix values to missing and retains the original values
gen_cv_sets <- function(folds, genotypes, fold_ct = NULL)
{
cv_genotype_list <- list()
if (!is.null(fold_ct))
{
iterator <- 1:fold_ct
} else
{
iterator <- unique(folds$which)
}
for (i in iterator)
{
fold_genotypes <- unlist(genotypes) # Decompose the matrix to simplify cross-validation index reference
orig_genotypes <- fold_genotypes[folds$subsets[folds$which == i]] # Save the original genotypes
fold_genotypes[folds$subsets[folds$which == i]] <- NA # Set the values to missing
fold_genotypes <- matrix(fold_genotypes, ncol = ncol(genotypes), nrow = nrow(genotypes))
names(fold_genotypes) <- names(genotypes)
row.names(fold_genotypes) <- row.names(genotypes)
fold_list <- list(fold_genotypes, orig_genotypes)
names(fold_list) <- c('fold_genotypes', 'orig_genotypes')
cv_genotype_list[[i]] <- fold_list
names(cv_genotype_list)[i] <- paste('fold_', i)
}
return(cv_genotype_list)
}
test <- gen_cv_sets(folds, genotypes, fold_ct = 10)
cv_genotype_list <- list()
iterator = 1:10
i = 1
fold_genotypes <- unlist(genotypes) # Decompose the matrix to simplify cross-validation index reference
orig_genotypes <- fold_genotypes[folds$subsets[folds$which == i]] # Save the original genotypes
fold_genotypes[folds$subsets[folds$which == i]] <- NA # Set the values to missing
fold_genotypes <- matrix(fold_genotypes, ncol = ncol(genotypes), nrow = nrow(genotypes))
fold_genotypes <- unlist(genotypes) # Decompose the matrix to simplify cross-validation index reference
genotypes <- data.frame(read.table("mdp_numeric.txt", header = T, row.names = 1, colClasses = classes, stringsAsFactors = F, sep = "\t"))
# This function uses a cvFolds assignment to set matrix values to missing and retains the original values
gen_cv_sets <- function(folds, genotypes, fold_ct = NULL)
{
cv_genotype_list <- list()
if (!is.null(fold_ct))
{
iterator <- 1:fold_ct
} else
{
iterator <- unique(folds$which)
}
for (i in iterator)
{
fold_genotypes <- unlist(genotypes) # Decompose the matrix to simplify cross-validation index reference
orig_genotypes <- fold_genotypes[folds$subsets[folds$which == i]] # Save the original genotypes
fold_genotypes[folds$subsets[folds$which == i]] <- NA # Set the values to missing
fold_genotypes <- data.frame(matrix(fold_genotypes, ncol = ncol(genotypes), nrow = nrow(genotypes)))
names(fold_genotypes) <- names(genotypes)
row.names(fold_genotypes) <- row.names(genotypes)
fold_list <- list(fold_genotypes, orig_genotypes)
names(fold_list) <- c('fold_genotypes', 'orig_genotypes')
cv_genotype_list[[i]] <- fold_list
names(cv_genotype_list)[i] <- paste('fold_', i)
}
return(cv_genotype_list)
}
test <- gen_cv_sets(folds, genotypes, fold_ct = 10)
write.table(test[1][[1]], quote = F, sep = '\t', file = 'mdp_numeric_na.txt')
test_table <- test[1][[1]]
test_table <- test[[1]][[1]]
write.table(test[[1]][[1]], quote = F, sep = '\t', file = 'mdp_numeric_na.txt')
genotypes = "newdata.vcf"
outfile = "test_output"
# Set the working directory
setwd("C:/Users/mmcgo/Dropbox/CROPS545_Spring2020/Labs/lab3_4_imputation")
# Define the system command
command_prefix <- "java -Xmx1g -jar beagle.25Nov19.28d.jar"
command_args <- paste(" gt=", genotypes, " out=", outfile, sep = "")
command <- paste(command_prefix, command_args)
# Run BEAGLE using the system function
test <- system(command, intern = T, invisible = F)
# Split the genotype file into 100 folds (each fold will be ~1% of the data)
fold <- cvFolds(1:length(unlist(genotypes)), 100)
?cvFolds
library(cvTools) # This package will be used for randomized k-fold cross-validation of imputation accuracy
?cvFolds
# Load dependencies
library(ggplot2)
library(cvTools) # This package will be used for randomized k-fold cross-validation of imputation accuracy
source(impute_functions)
# Set the working directory
setwd("C:/Users/mmcgo/Dropbox/CROPS545_Spring2020/Labs/lab3_4_imputation")
# Load dependencies
library(ggplot2)
library(cvTools) # This package will be used for randomized k-fold cross-validation of imputation accuracy
source(impute_functions)
source('IMPUTATION_functions.R')
# Import genotypes
gt_scan <- data.frame(read.table("mdp_numeric.txt", header = T, stringsAsFactors = F, sep = "\t", nrows = 1))
classes <- sapply(gt_scan, class)
genotypes <- data.frame(read.table("mdp_numeric.txt", header = T, row.names = 1, colClasses = classes, stringsAsFactors = F, sep = "\t"))
marker_map <- read.table("mdp_SNP_information.txt", header = T, stringsAsFactors = F, sep = "\t")
marker_map <- read.table("mdp_SNP_information.txt", header = T, stringsAsFactors = F, sep = "\t")
marker_map <- read.table("mdp_numeric.map", header = T, stringsAsFactors = F, sep = "\t")
# Check if there are any missing values
unique(unlist(genotypes))
# Check marker minor allele frequencies
minor_allele_freq <- apply(genotypes, 2, function(x)
{
allele_freq1 <- (sum(x == 0)*2 + sum(x == 1)) / (sum(!is.na(x)) * 2)
allele_freq2 <- (sum(x == 2)*2 + sum(x == 1)) / (sum(!is.na(x)) * 2)
return(min(allele_freq1, allele_freq2))
})
# Plot the minor allele frequency
qplot(minor_allele_freq, bins = 50) +
labs(x = 'Minor Allele Frequency', y = "Number of Genes", title = 'Histogram of minor allele frequency')
# Filter out markers with maf <= 0.05
genotypes_maf_filt <- genotypes[,minor_allele_freq > 0.05]
# Split the genotype file into 100 folds (each fold will be ~1% of the data)
folds <- cvFolds(1:length(unlist(genotypes)), 100)
# Split the genotype file into 100 folds (each fold will be ~1% of the data)
folds <- cvFolds(1:length(unlist(genotypes)), K = 100)
# Split the genotype file into 100 folds (each fold will be ~1% of the data)
folds <- cvFolds(length(unlist(genotypes)), K = 100)
# This function uses a cvFolds assignment to set matrix values to missing and retains the original values
gen_cv_sets <- function(folds, genotypes, fold_ct = NULL)
{
cv_genotype_list <- list()
if (!is.null(fold_ct))
{
iterator <- 1:fold_ct
} else
{
iterator <- unique(folds$which)
}
for (i in iterator)
{
fold_genotypes <- unlist(genotypes) # Decompose the matrix to simplify cross-validation index reference
orig_genotypes <- fold_genotypes[folds$subsets[folds$which == i]] # Save the original genotypes
fold_genotypes[folds$subsets[folds$which == i]] <- NA # Set the values to missing
fold_genotypes <- data.frame(matrix(fold_genotypes, ncol = ncol(genotypes), nrow = nrow(genotypes)))
names(fold_genotypes) <- names(genotypes)
row.names(fold_genotypes) <- row.names(genotypes)
fold_list <- list(fold_genotypes, orig_genotypes)
names(fold_list) <- c('fold_genotypes', 'orig_genotypes')
cv_genotype_list[[i]] <- fold_list
names(cv_genotype_list)[i] <- paste('fold_', i)
}
return(cv_genotype_list)
}
genotypes_na <- gen_cv_sets(folds, genotypes, fold_ct = 10)
x <- genotypes_na[[1]][[1]]
x_vect <- x[,1]
x_vect
x_imp <- x_vect
x_imp[is.na(x_imp)] <- mean(x_imp, na.rm = T)
x_imp
cor(x_imp, genotypes_na[[1]][[2]])
# Extract just a single fold for easy testing
genotypes_na <- genotypes_na_folds[[1]][[1]]
genotypes_na_folds <- gen_cv_sets(folds, genotypes, fold_ct = 10)
# Extract just a single fold for easy testing
genotypes_na <- genotypes_na_folds[[1]][[1]]
# Perform mean imputation for a given genotype table
mean_impute <- function(genotypes)
{
genotypes_imp <- apply(genotypes, 2, function(x) {
x[is.na(x)] <- mean(x, na.rm = T)
})
return(genotypes_imp)
}
# Calculate imptuation accuracy
impute_acc <- function(genotypes, genotypes_na, genotypes_imp)
{
na_indices <- which(is.na(genotype_na)) # Get the indices of missing values
orig_values <- genotypes[na_indices]
imp_values <- genotypes_imp[na_indices]
accuracy <- cor(orig_values, imp_values)
return(accuracy)
}
# Calculate imptuation accuracy
calc_impute_acc <- function(genotypes, genotypes_na, genotypes_imp)
{
na_indices <- which(is.na(genotype_na)) # Get the indices of missing values
orig_values <- genotypes[na_indices]
imp_values <- genotypes_imp[na_indices]
accuracy <- cor(orig_values, imp_values)
return(accuracy)
}
accuracy <- calc_impute_acc(genotypes, genotypes_na, genotypes_imp)
# Extract just a single fold for easy testing
genotypes_na <- genotypes_na_folds[[1]][[1]]
genotypes_imp <- mean_impute(genotypes_na)
# Perform mean imputation for a given genotype table
impute_mean <- function(genotypes)
{
for (i in 1:col(genotypes))
{
na_indices <- is.na(genotypes[,i])
genotypes[na_indices,i] <- mean(genotypes[,i], na.rm = T)
}
return(genotypes)
}
genotypes_imp <- impute_mean(genotypes_na)
# Perform mean imputation for a given genotype table
impute_mean <- function(genotypes)
{
for (i in 1:ncol(genotypes))
{
na_indices <- is.na(genotypes[,i])
genotypes[na_indices,i] <- mean(genotypes[,i], na.rm = T)
}
return(genotypes)
}
genotypes_imp <- impute_mean(genotypes_na)
accuracy <- calc_impute_acc(genotypes, genotypes_na, genotypes_imp)
# Extract just a single fold for easy testing
genotypes_na <- genotypes_na_folds[[1]][[1]]
genotypes_imp <- impute_mean(genotypes_na)
accuracy <- calc_impute_acc(genotypes, genotypes_na, genotypes_imp)
# Calculate imptuation accuracy
calc_impute_acc <- function(genotypes, genotypes_na, genotypes_imp)
{
na_indices <- which(is.na(genotypes_na)) # Get the indices of missing values
orig_values <- genotypes[na_indices]
imp_values <- genotypes_imp[na_indices]
accuracy <- cor(orig_values, imp_values)
return(accuracy)
}
accuracy <- calc_impute_acc(genotypes, genotypes_na, genotypes_imp)
na_indices <- which(is.na(genotypes_na)) # Get the indices of missing values
na_indices <- which(is.na(genotypes_na), arr.ind = T) # Get the indices of missing values
orig_values <- genotypes[na_indices]
8692/281*3093
8692/(281*3093)
na_indices <- which(is.na(genotypes_na), arr.ind = T) # Get the indices of missing values
orig_values <- genotypes[na_indices]
imp_values <- genotypes_imp[na_indices]
qplot(orig_values, imp_values)
cor(orig_values, imp_values)
accuracy <- cor(orig_values, imp_values)
return(accuracy)
# Calculate imptuation accuracy
calc_impute_acc <- function(genotypes, genotypes_na, genotypes_imp)
{
na_indices <- which(is.na(genotypes_na), arr.ind = T) # Get the indices of missing values
orig_values <- genotypes[na_indices]
imp_values <- genotypes_imp[na_indices]
accuracy <- cor(orig_values, imp_values)
return(accuracy)
}
accuracy <- calc_impute_acc(genotypes, genotypes_na, genotypes_imp)
accuracy
length(genotypes_na_folds)
accuracy_vect <- vector(type = 'numeric', size = length(genotypes_na_folds))
accuracy_vect <- vector(mode = 'numeric', length = length(genotypes_na_folds))
# Testing across all folds
accuracy_cv <- test_mean_impute_cv(genotypes, genotypes_na_folds)
# This function will test the accuracy of mean imputation across a set of folds
test_mean_impute_cv <- function(genotypes, genotypes_na_folds)
{
accuracy_vect <- vector(mode = 'numeric', length = length(genotypes_na_folds))
for (i in 1:length(accuracy_vect))
{
genotypes_na <- genotypes_na_folds[[i]][[1]] # Extract the genotypes with missing values
genotypes_imp <- impute_mean(genotypes_na) # Perform imputation
accuracy_vect[i] <- calc_impute_acc(genotypes, genotypes_na, genotypes_imp) # Calculate an accuracy
}
return(accuracy_vect)
}
# Testing across all folds
accuracy_cv <- test_mean_impute_cv(genotypes, genotypes_na_folds)
# This function will test the accuracy of mean imputation across a set of folds
test_mean_impute_cv <- function(genotypes, genotypes_na_folds)
{
accuracy_vect <- vector(mode = 'numeric', length = length(genotypes_na_folds))
for (i in 1:length(accuracy_vect))
{
print(paste("Testing fold: ", i, sep = ''))
genotypes_na <- genotypes_na_folds[[i]][[1]] # Extract the genotypes with missing values
genotypes_imp <- impute_mean(genotypes_na) # Perform imputation
accuracy_vect[i] <- calc_impute_acc(genotypes, genotypes_na, genotypes_imp) # Calculate an accuracy
}
return(accuracy_vect)
}
# Testing across all folds
accuracy_cv <- test_mean_impute_cv(genotypes, genotypes_na_folds)
accuracy_cv
mean(accuracy_cv)
# This function uses a cvFolds assignment to set matrix values to missing and retains the original values
# folds = a cvFolds object that split all genotype indices into different groups
# genotypes = a numeric genotype matrix (rows = taxa, columns = markers)
# fold_ct = the number of folds to use for genotype subsetting (if NULL, use all folds)
get_gen_cv_sets <- function(folds, genotypes, fold_ct = NULL)
{
cv_genotype_list <- list()
if (!is.null(fold_ct))
{
iterator <- 1:fold_ct
} else
{
iterator <- unique(folds$which)
}
for (i in iterator)
{
fold_genotypes <- unlist(genotypes) # Decompose the matrix to simplify cross-validation index reference
fold_genotypes[folds$subsets[folds$which == i]] <- NA # Set the values to missing
fold_genotypes <- data.frame(matrix(fold_genotypes, ncol = ncol(genotypes), nrow = nrow(genotypes))) # Recompose the genotype matrix
names(fold_genotypes) <- names(genotypes)
row.names(fold_genotypes) <- row.names(genotypes)
fold_list <- list(fold_genotypes)
names(fold_list) <- c('fold_genotypes')
cv_genotype_list[[i]] <- fold_list
names(cv_genotype_list)[i] <- paste('fold_', i)
}
return(cv_genotype_list)
}
genotypes_na_folds <- get_gen_cv_sets(folds, genotypes, fold_ct = 10)
# Split the genotype file into 100 folds (each fold will be ~1% of the data)
folds <- cvFolds(length(unlist(genotypes)), K = 100)
genotypes_na_folds <- get_gen_cv_sets(folds, genotypes, fold_ct = 10)
# Testing just a single fold
genotypes_na <- genotypes_na_folds[[1]][[1]] # Extract just a single fold for easy testing
genotypes_imp <- impute_mean(genotypes_na) # Impute the values
accuracy <- calc_impute_acc(genotypes, genotypes_na, genotypes_imp) # Calculate the accuracy
# Testing across all folds
accuracy_cv <- test_mean_impute_cv(genotypes, genotypes_na_folds)
# Plot these accuracies
qplot(accuracy_cv, geom = boxplot)
# Plot these accuracies
qplot(accuracy_cv, geom = 'boxplot')
# Plot these accuracies
qplot(x = 1, y = accuracy_cv, geom = 'boxplot')
# Plot these accuracies
qplot(x = 1, y = accuracy_cv, geom = 'boxplot') +
labs(title = 'Accuracy of mean imputation', x = 'Missing percentage', y = 'Accuracy')
# Plot these accuracies
qplot(x = factor(1), y = accuracy_cv, geom = 'boxplot') +
labs(title = 'Accuracy of mean imputation', x = 'Missing percentage', y = 'Accuracy')
source('IMPUTATION_functions.R')
