-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from mpip/new_features
New features
- Loading branch information
Showing
4 changed files
with
51 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
### Function calculating number of PCs to be kept for batch identification and correction | ||
# threshold for N of PCs: start at PC1 and keep including PCs until drop in explained variance from PCi to PCi+2 < 1% | ||
# if threshold >2, include first 2 PCs (needed for plots) | ||
# include max 10 PCs | ||
|
||
pc_cutoff <- function(data){ | ||
for(i in 1:nrow(data)) { | ||
if(i > 10) break | ||
else if((data[i,]$var_explained - data[i + 2,]$var_explained) >=1) PC_number <- i | ||
else if(PC_number < 2) PC_number = 2 | ||
else break | ||
} | ||
return(PC_number) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters