Dear Sven,
dif is an empty matrix, what im trying to do with this command sheet is to
fill it with values. it should work, as far as i know. how else would you do
it?
Sebastiano Putoto schrieb:
>* 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.
*
Well it looks to me as if 'dif' is a matrix of dimension 0x0, so how are
you going to fit something in a slice [i,] of it?
-sven
--
Cordiali saluti/Salutations/Best Regards
Sebastiano Putoto