Я пытался работать с матрицами в Stata, но мне сложно, если не путать.
В NumPy
Я могу сделать:
In [1]: A = np.array([np.arange(1,7),np.arange(7,13),np.arange(13,19),
np.arange(19,25),np.arange(25,31),np.arange(31,37)])
In [2]: A
Out[2]:
array([[ 1, 2, 3, 4, 5, 6],
[ 7, 8, 9, 10, 11, 12],
[13, 14, 15, 16, 17, 18],
[19, 20, 21, 22, 23, 24],
[25, 26, 27, 28, 29, 30],
[31, 32, 33, 34, 35, 36]])
In [3]: B = A[2, -3]
In [4]: B
Out[4]: 16
In [5]: B = A[::2,:]
In [6]: B
Out[6]:
array([[ 1, 2, 3, 4, 5, 6],
[13, 14, 15, 16, 17, 18],
[25, 26, 27, 28, 29, 30]])
In [7]: B = A[:,::2]
In [8]: B
Out[8]:
array([[ 1, 3, 5],
[ 7, 9, 11],
[13, 15, 17],
[19, 21, 23],
[25, 27, 29],
[31, 33, 35]])
Можно ли что-то подобное сделать в Stata?