[Gretl-devel] array indexing
Vaidotas Zemlys
zemlys at gmail.com
Tue Aug 22 09:08:50 EDT 2006
Hi,
Pr, 2006 08 21 23:50 -0400, Allin Cottrell rašė:
> I recently made some changes so that array indexing in the
> context of the "restrict" command starts at 1 in all cases
> (previously there was a mixture of 0-base and 1-base).
>
> Working again with matrices lately, I recall that gretl matrices
> also use 1-based indexation. So we're consistent.
>
> But is this "right"? Would we be better to standardize on
> 0-based indexing in all cases? My initial thought was that
> 1-base is more intuitive for the "punters", but I have to say it
> seems odd for matrices. Ox uses 0-base; does R do that too?
>
R uses 1-base indexing. If x is vector, x[1] is the first element, if m
is array, or matrix, or data frame, m[1,] is the first row, m[,1] is the
first column. In context of linear hypothesis testing, if restriction is
A\beta=b, with \beta being the regression coefficients, you must provide
matrix B and vector b.
Vaidotas
More information about the Gretl-devel
mailing list