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

0

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

0

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,
75,
41,
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];
endfor;
```

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.

0

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,
75,
41,
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];
endfor;
```

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.

• ### Aptech Systems, Inc. Worldwide Headquarters

Aptech Systems, Inc.
2350 East Germann Road, Suite #21
Chandler, AZ 85286

Phone: 360.886.7100
FAX: 360.886.8922

• ### Training & Events

Want more guidance while learning about the full functionality of GAUSS and its capabilities? Get in touch for in-person training or browse additional references below.

• ### Tutorials

Step-by-step, informative lessons for those who want to dive into GAUSS and achieve their goals, fast.

• ### Want to find out more?

Get a real answer from a real person

• ### Have a Specific Question?

Get a real answer from a real person

• Need Support?
• ### Support Plans

Premier Support and Platinum Premier Support are annually renewable membership programs that provide you with important benefits including technical support, product maintenance, and substantial cost-saving features for your GAUSS System or the GAUSS Engine.

• ### User Forums

Join our community to see why our users are considered some of the most active and helpful in the industry!