필터 지우기
필터 지우기

How to create a program to compute the Hii of the Hat Marix in matlab?

조회 수: 2 (최근 30일)
amj
amj 2018년 1월 10일
편집: amj 2018년 1월 11일
I'm facing with the problem to compute the Hii of the Hat Matrix at shown in the picture.
Can anyone help me on how to compute? It is supposed to get a single values. However, in my code, it is appeared as 2x2 matrix. Thanks in advance
  댓글 수: 4
amj
amj 2018년 1월 10일
편집: amj 2018년 1월 10일
This is the code without using csv file:
a = [1 20;1 30;1 40]
for i = 1:length(a)
disp(a(i,:)'.*(a'*a).*a(i,:))
end
But, the result i got as 2x2 matrix not as expected
amj
amj 2018년 1월 10일
Thanks Rik Wisselink.. Let me check the link

댓글을 달려면 로그인하십시오.

채택된 답변

the cyclist
the cyclist 2018년 1월 10일
Is this what you want?
x = rand(10,1);
i = 3;
x(i)' .* x'*x .* x(i)
  댓글 수: 3
the cyclist
the cyclist 2018년 1월 10일
I misinterpreted your notation in the example. I believe you can calculate the diagonal element as
a = [1 20;1 30;1 40]
i = 3;
Hii = a(i,:) * inv(a'*a) * a(i,:)'
and the full H matrix as
H = a * inv(a'*a) * a'
There is probably a more efficient way to calculate that, rather than using the full inverse, but I am too lazy to figure it out.
amj
amj 2018년 1월 11일
편집: amj 2018년 1월 11일
Dear The cyclist,
Let me try.
Thanks you very much

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Matrices and Arrays에 대해 자세히 알아보기

태그

아직 태그를 입력하지 않았습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by