Sir, once matrix is reduced to m(<p)components in y=Xb+e, i found dimension problem in gettig mean square error. How to reolve it? error in 22nd line of program and is given below

1. X % is a nxp matrix 2. beta0 % is a px1 vector 3. E=sort(lamda, 'descend'); 4. N=nnz(cumsum(E/sum(E))<=0.95) 5. Xm = X(:,[1:N]); %m<p -components 6. [P1,T1]=princomp(Xm); 7. Tm=T1(:,[1:N]); 8. Pm=P1(:,[1:N]) ; 9. Dm=T'*T; 10. f=normrnd(0,sig,n,1); 11. F=normrnd(MU2, SIGMA2, n, N); 12. Q1=princomp(X); 13. q=Q1([1],[1:N]); 14. f=F(:, [1]); 15. y=T*q'+f; 16. gama2=Tm'*f; 17. blngamaols=inv(Dm)*Tm'*y 18. blngama=P'*gama2 19. blnksv=estsigmasq/(transpose(blngamaols)*blngamaols) 20. Am=Dm+blnksv*eye(N) 21. gamahatksv=(eye(N)-pinv(Am)*blnksv)*blngamaols 22. mserizeksv=(gamahatksv-beta0)'*(gamahatksv-beta0)

Answers (0)

Asked:

on 21 Jan 2016

Commented:

on 21 Jan 2016

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!