We used K-nearest-neighbors (KNN) imputation to account for missing confounder data using the kNN function from the VIM package (Kowarik & Templ, 2016) in R. We conducted KNN imputation with 5 neighbors, mean aggregation (mean option) for continuous variables, and modal aggregation (maxCat option) for binary variables. We used all variables in the set of confounder variables to identify neighbors. Next, we calculated a mixed correlation matrix of Pearson, polychoric, and polyserial correlations from the imputed phenotype data. Variables were removed if they caused errors in the correlation matrix of imputed phenotype data. We calculated eigenvectors from this correlation matrix using eigen function in R. We post multiplied the imputed data by the eigenvectors to generate principal components and used parallel analysis to determine the number of principal components to retain as covariates using the paran function from the paran package (Dinno, 2018) in R. We conducted the parallel analysis using the mixed correlation matrix, n set to the number of rows in the imputed data, and 1000 iterations. We constructed PCs to be orthogonal to the PRS by extracting