Rettet feil etter forenkling av PCR

This commit is contained in:
Joakim Skogholt 2024-05-26 11:05:16 +02:00
parent a3a9c631ba
commit 82740963ec

View file

@ -95,24 +95,16 @@ stdX = std(X, dims=1);
mX = mean(X, dims=1);
my = mean(y, dims=1);
y = y .- my;
if centre
X = X .- mX;
end
#if standardize
# X = X ./ stdX;
#end
U, s, V = svd(X, full=false);
q = s[1:kmax].^(-1) .*(U[:,1:kmax]'y);
B = cumsum(V[:,1:kmax] .* q', dims=2);
if centre
b0 = my .- mX * B
B = [b0; B];
end
return B, U, s, V
end