On Wed, 10 Apr 2013, artur bala wrote:
Dear Allin,
I'm using the "diff" comand on a (n x 1) matrix and the result is still a
(n
x 1) matrix which the 1st element equals 0. Is such a behaviour intended?
I thought that the result should be a ((n-1) x 1) because of lagging (same as
with series).
Well, it's as per the documentation for the diff() function:
"If y is a matrix, differencing is done by columns and
starting values are set to 0." You can easily trim the first
row if you wish.
matrix dy = diff(y)
dy = dy[2:,]
Actually, it might be nice if we supported
dy = diff(y)[2:,]
but we don't right now.
Allin