how can I combine the name part and data part??

The below is what you say. Then, how can I combine the name part and data part??

range = xlsMakeRange(1|1, 1|367); varnames = spreadSheetReadSA("myfile.xls", range, 1); mydata = spreadSheetReadM("myfile.xls", "B1", 1);

1 Answer


Usually you don't want to combine the name and data together in the matrix. GAUSS is a matrix language that is designed to easily write code that looks like the underlying mathematics.

Let's say that you have a simple model with Income as the dependent variable while Age and Education are the explanatory variables. This simple example will start with a 4x1 vector representing Income and a 4x2 matrix where the first column represents Age and the second column represents Education. We will also have a string array containing the names of the dependent variables.

//'y' contains income
y = { 50, 
      63 };

//The first column of 'x'
//is age, the second is education
x = { 35 12,
      59  7,
      44  9,
      47  16 };

//String array with variable names
string varnames = { "Age", "Education" };

//Least squares estimation
b_hat = y/x;

//Print parameter values
for i(1, rows(varnames), 1);
	print "The estimated parameter value for "$+varnames[i];
	print "is equal to " b_hat[i];

This code will produce the output:

The estimated parameter value for Age
is equal to        1.0979158 
The estimated parameter value for Education
is equal to       0.61703551 

In this simple program above, we do not need the variable names in x and y. The matrices contain only the data, which is what we need for calculations. Reporting our output in terms of the variable names is easy to do since we know they are at the same position in varnames that their corresponding data is in x.

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.


Thank you for your interest in the GAUSS family of products.

© Aptech Systems, Inc. All rights reserved.

Privacy Policy | Sitemap