Hey guys,

I am new in Gauss but i am willing to learn it. There is a code below about a cointegration model's data's uploading. I could not understand what should i input in the second part.

load data[7000,4]=C:\Users\user\Desktop\gauss\coin\returns.txt;

datap=data[? , ?]~data[?,?]~data[?,?];

I think sceond line about the definition of dependent and indepenedent variables. Btw I have one dependent and 3 independent variable. Do you have any idea

Best

B&D

## 2 Answers

The second line is arranging the columns in some manner to create a new matrix that I am guessing will be the independent variable. To understand the second line you posted and know how to use it, you need to know how to index matrices in GAUSS and also about matrix concatenation.

The main things to know are that the tilde operator `~` performs horizontal concatenation. While we are at it, we may as well mention that the pipe operator `|` performs vertical concatenation. For example:

```
//Create some data to play with
A = { 1, 2, 3, 4 };
B = { 7, 8, 9, 10 };
C = { 13, 17, 19, 23 };
```

will create two column vectors:

1 7 13 A = 2 B = 8 C = 17 3 9 19 4 10 23

We can create a new matrix `X` which contains the contents of all three matrices above with the tilde operator, like this:

```
//Horizontal concatenation of three column vectors
X = A~B~C;
```

Now in addition to the vectors `A`, `B` and `C`, we will have this matrix `X` below:

1 7 13 X = 2 8 17 3 9 19 4 10 23

Now let's introduce indexing. GAUSS uses square brackets `[ ]` to indicate an indexing operation. The square brackets will contain a comma separated list of indices. Since we are dealing with matrices here (not N-dimensional arrays) we will have only two indices--one for the rows and the second for the columns. For example:

```
//Extract one element
Z = X[2, 3];
```

will assign `Z` to equal 17. You can use the colon operator to indicate a range. So if we wanted to assign `Z` to equal the second, third and fourth elements from the third column of `X`, we would use this command:

Z = X[2:4, 3];

and `Z` would now equal:

17 Z = 19 23

The final operator that you need to know to use indexing is the dot operator `'.'`. A dot inside the indexing brackets means "all" rows or columns. For example, to set `Z` to equal the second column of `X` could be done like this:

Z = X[.,2];

We could set `Z` equal to the third row of `X` like this:

Z = X[3,.];

Finally, it is very common to load a matrix with multiple variables in which the first column is the dependent variable and all subsequent columns are independent variables. Continuing to use the three column `X` from above, we might do something like this:

//Create 'indvar' from first column of 'X' indvar = X[.,1]; //Create 'depvar' from 2nd and 3rd columns of 'X' depvar = X[.,2:3];

Play around with this and post any further questions that come up.

Thank you very much for all the information