# # function Q=optscal(G,M,y) # # Compute the optimally scaled data matrix from the indicator # matrix and the output of HOMALS # # Input: # G, the indicator matrix # M, row vector (1,m). Each entry of M equals the number # of categories of the corresponding column of H. # G has n rows and mm=sum(M) columns. M is obtained from # function htoind. # y, column vector (mm,1). Output of HOMALS. It contains the # category quantifications # # Output: # Q, the optimally scaled data matrix. # function Q=optscal(G,M,y) m=length(M); [n,mm]=size(G); if sum(M)!= mm || length(y)!= mm disp('***optscal: incompatible data'); return endif Q=zeros(n,m); jmax=0; for alpha=1:m jmin=jmax+1; jmax=jmax+M(alpha); Q(:,alpha)=G(:,jmin:jmax)*y(jmin:jmax); endfor endfunction