Cannot print all matrices

I am running a Regional I-O model. Although I get printed the Regional Transactions Matrix, I cannot get the Leontief inverse of it printed. Instead, I get only dots.

/* Step 3.4: Computation of Regional Matrices */
DRMRg=CILQ.*DRMNt;
/* Regional Direct Requirements Matrix mxm */
ImpRgCf1=(sumc(drmnt-drmrg));
/*Regional Imports Coefficients vector adjusted for CILQ mx1*/
Print; print "Direct Requirements Regional for THESS"; print DRMRg;

/* Step 3.5: Sectoral Aggregation – Definition of the Regional Classification Scheme*/

C3=eye(m);
C4=C3-DRMRg;
LEONTIEFRg=inv(C4);
/* Regional Leontief Inverse Matrix mxm */
PrdnRg=(PrdnNt).*(EmpRg./EmpNt);
/* Regional Sectoral Output mx1 */
TransRg=DRMRg*diagrv(zeros(m,m),PrdnRg);
/* Regional Transactions Matrix */
ImpRgf=ImpRgCf1.*PrdnRg;

/* Regional Imports Vector mx1, from coefficients to values */
Print; print "Leontief Regional for THESS"; print LEONTIEFRg;
Print; print "Regional Sectoral Output"; print PrdnRg;
format /rds 14,3;
Print; print "Regional Transactions Matrix for THESS"; print TransRg;

1 Answer



0



In GAUSS, missing values and NaN's are represented by a dots. So if you print a GAUSS matrix and you see one or more dots, this is the problem. Here is a quick example:

// Create 2x2 matrix with one missing value
a = { 1 .,
      3 4 };

b = 2.5;

// Create a 1x1 missing value
c = { . };

print "a.*b = " a.*b;
print "a.*c = " a.*c;

The printed output will be:

a.b =
       2.5000000                .
       7.5000000        10.000000
a.c =
               .                .
               .                . 

You can use the GAUSS function isinfnanmiss to check to see if a matrix contains ANY missing values, NaN's or infinities. For example after the code above, we could check a like this:

if isinfnanmiss(a);
   print "'a' has infinities, NaN's or missing values";
else;
   print "'a' is a finite matrix";
endif;

To find the cause of your problem, you need to go back and see where the matrix with the missing values, TransRg, was created. From your code, we can see that it was created on this line:

/* Regional Sectoral Output mx1 */
TransRg=DRMRg*diagrv(zeros(m,m),PrdnRg);

This means that either DRMRg or PrdnRg has NaN's. You can use the isinfnanmiss function and/or some print statements to find out which is the problem and then trace it back to the source of the NaN's to solve your problem.

aptech

1,773

Your Answer

1 Answer

0

In GAUSS, missing values and NaN's are represented by a dots. So if you print a GAUSS matrix and you see one or more dots, this is the problem. Here is a quick example:

// Create 2x2 matrix with one missing value
a = { 1 .,
      3 4 };

b = 2.5;

// Create a 1x1 missing value
c = { . };

print "a.*b = " a.*b;
print "a.*c = " a.*c;

The printed output will be:

a.b =
       2.5000000                .
       7.5000000        10.000000
a.c =
               .                .
               .                . 

You can use the GAUSS function isinfnanmiss to check to see if a matrix contains ANY missing values, NaN's or infinities. For example after the code above, we could check a like this:

if isinfnanmiss(a);
   print "'a' has infinities, NaN's or missing values";
else;
   print "'a' is a finite matrix";
endif;

To find the cause of your problem, you need to go back and see where the matrix with the missing values, TransRg, was created. From your code, we can see that it was created on this line:

/* Regional Sectoral Output mx1 */
TransRg=DRMRg*diagrv(zeros(m,m),PrdnRg);

This means that either DRMRg or PrdnRg has NaN's. You can use the isinfnanmiss function and/or some print statements to find out which is the problem and then trace it back to the source of the NaN's to solve your problem.


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