NMR Batch Correction Example Script: Difference between revisions
From Powers Wiki
(Created page with "== PLS Fit Model == X = whole dataset (first & second);clsD = class info (dummy matrix). result = pls(X, clsD, @suv, [7,1], 1); mn = result.mean.X;sd = result.scale....") |
(Added to Category) |
||
Line 20: | Line 20: | ||
Note: mean can be replaced with median in a median of median model. | Note: mean can be replaced with median in a median of median model. | ||
[[category:Protocols|Protocols]] | |||
[[category:Data_Processing_and_Analysis]] |
Revision as of 03:26, 11 September 2021
PLS Fit Model
X = whole dataset (first & second);clsD = class info (dummy matrix). result = pls(X, clsD, @suv, [7,1], 1); mn = result.mean.X;sd = result.scale.X; Xscaled = (X-(repmat(mn,[size(X,1),1])))./(repmat(sd,[size(X,1),1]));%size(Xscaled) XPLSfit = result.T*result.P'; XscaledNew = Xscaled - XPLSfit; XNew = (XscaledNew.*(repmat(sd,[size(XscaledNew,1),1]))) + (repmat(mn,[size(XscaledNew,1),1]));
Mean of Mean Model
Xall = [Xtrain;Xtest]; refX = median(median(Xall)); mnXtrain = mean(mean(Xtrain)); newXtrain = Xtrain/repmat(mnXtrain, [size(Xtrain, 1), size(Xtrain, 2)]); newXtrain = newXtrain*repmat(refX, [size(Xtrain, 1), size(Xtrain, 2)]); mnXtest = mean(mean(Xtest)); newXtest = Xtest/repmat(mnXtest, [size(Xtest, 1), size(Xtest, 2)]); newXtest = newXtest*repmat(refX, [size(Xtest, 1), size(Xtest, 2)]);
Note: mean can be replaced with median in a median of median model.