Assigning names to columns of matrix

This supposed to be easy but I don't know how to do it because I'm new to GAUSS

Let's suppose I have the following data

Date               R                FPI
1/1/1995   -142.35     772.9438637
2/1/1995   70.73       922.9710357
3/1/1995   -71.79      1079.098705
4/1/1995   -7.99       1247.427367
5/1/1995   183.62    1417.232295
6/1/1995   2.46        1510.487858

After loading into GAUSS it looks like this

1.9950101e+13    -142.35000    772.94386
1.9950201e+13    70.730000    922.97104
1.9950301e+13    -71.790000   1079.0987
1.9950401e+13    -7.9900000  1247.4274
1.9950501e+13    183.62000    1417.2323

The first column is the dates, the second and third columns are the variables R and P respectively, How can I assign names to each column in the data? Also, I need to transform the dates column from numeric format to date format. How can I do that?

4 Answers



0



accepted

I would suggest that you select only the dates which are found to have the breaks and convert them to your preferred string format for printing. Here is some code with a toy data matrix similar to yours in which we assume that the structural breaks are found at the 2nd and 4th date.

data = { 19950101000000 -142.35  772.94386,
         19950201000000   70.73  922.97104,
         19950301000000  -71.79  1079.0987,
         19950401000000   -7.99  1247.4274,
         19950501000000  183.62  1417.2323,
         19950601000000   12.31   1392.4401 };

// We found structural breaks at index 2 and 4
break_idx = { 2, 4 };

// Extract DT scalar break dates from first column
break_dates = data[break_idx,1];

// Convert DT scalars to strings in the format MONTH/DAY/YEAR
break_dates = dttostr(break_dates, "MO/DD/YYYY");

// Print results
print "Structural breaks found at:";
print break_dates;

It could be more compact, but I made it verbose so you could see the output from each section. The printed results should be:

      02/01/1995
      04/01/1995

aptech

1,773


0



Matrix columns in GAUSS do not have names. You could create a GAUSS structure in which each column was a member and access the variables by name that way, or you could create scalar variables to use to access the columns.

However, there may even be a better solution to your final goal. It would be helpful to know your end goal. Are you planning to:

  • Pass this data to an estimation routine with some code that you have?
  • Create some custom GAUSS code?
  • Pass the data to a standard GAUSS function for something like OLS, GLM, GMM, etc?

aptech

1,773


0



I'm going to use the data with the code of time-varying causality provided by R.Hacker and Hatemi-J (2010)



0



The dates are very important for this model, this model basically tracks causality between two variables over time, the time at which there was causality relationship between the two variables and time at which no causality is found, so the timing of causality is important and without it, the outputs would be meaningless.

Your Answer

4 Answers

0
accepted

I would suggest that you select only the dates which are found to have the breaks and convert them to your preferred string format for printing. Here is some code with a toy data matrix similar to yours in which we assume that the structural breaks are found at the 2nd and 4th date.

data = { 19950101000000 -142.35  772.94386,
         19950201000000   70.73  922.97104,
         19950301000000  -71.79  1079.0987,
         19950401000000   -7.99  1247.4274,
         19950501000000  183.62  1417.2323,
         19950601000000   12.31   1392.4401 };

// We found structural breaks at index 2 and 4
break_idx = { 2, 4 };

// Extract DT scalar break dates from first column
break_dates = data[break_idx,1];

// Convert DT scalars to strings in the format MONTH/DAY/YEAR
break_dates = dttostr(break_dates, "MO/DD/YYYY");

// Print results
print "Structural breaks found at:";
print break_dates;

It could be more compact, but I made it verbose so you could see the output from each section. The printed results should be:

      02/01/1995
      04/01/1995

0

Matrix columns in GAUSS do not have names. You could create a GAUSS structure in which each column was a member and access the variables by name that way, or you could create scalar variables to use to access the columns.

However, there may even be a better solution to your final goal. It would be helpful to know your end goal. Are you planning to:

  • Pass this data to an estimation routine with some code that you have?
  • Create some custom GAUSS code?
  • Pass the data to a standard GAUSS function for something like OLS, GLM, GMM, etc?

0

I'm going to use the data with the code of time-varying causality provided by R.Hacker and Hatemi-J (2010)

0

The dates are very important for this model, this model basically tracks causality between two variables over time, the time at which there was causality relationship between the two variables and time at which no causality is found, so the timing of causality is important and without it, the outputs would be meaningless.


You must login to post answers.

Have a Specific Question?

Get a real answer from a real person

Need Support?

Get help from our friendly experts.

Try GAUSS for 14 days for FREE

See what GAUSS can do for your data

© Aptech Systems, Inc. All rights reserved.

Privacy Policy