Sorry, I did not mean that
The quantity generated should be a scalar, however.
but indeed tha the quantity indicated in blue is a scalar, so is not
concerned with conformability. Which is the point where I don't understand
Gretl.
2009/5/26 Sebastiano Putoto <sebastiano.putoto01(a)universitadipavia.it>
Good evening fellow Gretlians,
I am trying to run this command sheet but it doesn't work.
function LEVERAGE(matrix X, matrix y, matrix *u, matrix *h)
> matrix beta = inv(X'X)*X'*y # calculates coeffs through OLS
> matrix u = y - X*beta # residuals
> matrix Px = X'(inv(X'X))*X # orthogonal projector Px
> matrix h = diag(Px) # extract the elements fromt Px's diagonal
> matrix dif={}
> loop i=1..rows(X) --progressive # loop to work on each observation
> matrix xi = X[i,] #exctracting rows from X
> scalar u_i = u[i,]
> scalar h_i = h[i,]
> matrix dif[i,] = (-u_i/(1-h_i))*(inv(X'X)* xi) #calculate the
> difference between beta(t) and beta. <--- THESE - I SUPPOSE - ARE THE
> POINTS WHEN IT DOESN'T WORK.
> end loop
> return matrix dif
> end function
>
> open ESERCIZIO4.gdt
> include LEVERAGE
> matrix X={const, inv_gdp}
> matrix y={gdp_pw_g}
> matrix u
> matrix h
> dif = LEVERAGE ( X, y, &u, &h) <--- THESE - I SUPPOSE - ARE THE POINTS
> WHEN IT DOESN'T WORK.
> print
>
The idea is evaluating the leverage of observations, using the command
editor. However, when trying to create the dif matrix, using the leverage
function on an assigned dataset (included) it tells me them are not
conformable.
The quantity generated should be a scalar, however. When using this command
**
> matrix dif[i,] = (-u_i/(1-h_i))*(inv(X'X)* xi),
>
am i not telling Gretl to multiply a scalar (blue) by a matricial form
(green)?
Hope the explanation is clear, and that you will be able to help me with
this matter.
--
Cordiali saluti/Salutations/Best Regards
Sebastiano Putoto
--
Cordiali saluti/Salutations/Best Regards
Sebastiano Putoto