Added SNV

This commit is contained in:
Joakim Skogholt 2024-06-15 16:15:17 +02:00
parent 6b1916b8cd
commit 05b4b47a97
2 changed files with 14 additions and 3 deletions

View file

@ -30,6 +30,7 @@ export TRLooCVUpdateNaive
export TRLooCVUpdateExperimental
# From "variousRegressionFunctions.jl"
export SNV
export EMSC
export EMSCCorrection
export cVals

View file

@ -1,9 +1,19 @@
function SNV(X)
X_SNV = zeros(size(X));
means = mean(X, dims=2);
stds = std(X, dims=2);
X_SNV = @. (X - means) / stds;
return X_SNV;
end
function EMSCCorrection(X, basis)
coeffs = basis \ X';
X_Cor = (X - coeffs[2:end,:]' * basis[:,2:end]') ./ coeffs[1,:];
coeffs = basis \ X';
X_Cor = (X - coeffs[2:end,:]' * basis[:,2:end]') ./ coeffs[1,:];
return X_Cor
return X_Cor
end
function EMSC(X, polDeg=2)