SHAZAM Community
Ask Your Question

In a Flexible Least Squares (FLS) regression, how do you save the "coeff=var" results into a matrix?

asked 2014-01-10 13:14:42 +0000

OYassin gravatar image

For example, I have a coeff=CT at the end - which yields an n x k matrix - and then I use the write(Betas.mtx) CT to transfer it to a matrix but it gets diluted down to a single column

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2014-01-10 19:48:42 +0000

updated 2014-01-11 04:43:19 +0000

The matrix is being created and written correctly to the disk. The matrix can also be used in subsequent calculations.

However, there appears to be a bug in reading the header of the matrix when displaying in the data editor. This will be repaired in the next update (11.1) due shortly.

In the meantime you can open it in notepad as the file is simply text.

To write out a large matrix and override the default display, use a FORMAT statement. This example creates a 20 by 20 identity matrix and writes it to a file. See the SHAZAM Manual for more examples.

* Create an identity matrix 20x20
matrix x = iden(20)
* Define how to output 
* i.e. 20 columns of floating point of up to 8 digits with 4 decimal places
* Write the matrix x to the current path and use the previous format statement
write(xmatrix.mtx) x / format
edit flag offensive delete link more


Thanks! Opens well in notepad, however the result (which is supposed to be a 107x10 matrix as the header indicates correctly) turns out to be a 214x5 - basically it puts the last 5 columns under the first 5. Is there a way to adjust that default option?

OYassin gravatar imageOYassin ( 2014-01-10 22:08:14 +0000 )edit

Edited the answer above to show how to write using different formats.

SHAZAMHelp gravatar imageSHAZAMHelp ( 2014-01-11 04:43:51 +0000 )edit
Login/Signup to Answer

Question Tools

1 follower


Asked: 2014-01-10 13:14:42 +0000

Seen: 480 times

Last updated: Jan 11 '14