I have a nested loops of 3 different parameters and I want to generate the number of eigenvalues with mod>1, the total number of eigenvalues and whether the rank condition is verified into an excel file to check for determinacy/indeterminacy with each set of parameters. Is there a way that dynare can output that directly into an excel file? I heard dynare can read from excel file for estimation purpose so shouldn’t it be able to write to excel file also? Manual copying just takes too much time. Or if I can just produce a matrix of result in dynare and then copy it to excel that’ll be good also
Is it possible to do so in dynare?
On looping, see [Loop over parameters)
The easiest thing is to read out the eigenvalues from oo_.dr.eigval. You can count them yourself using Matlab code. Regarding writing the final matrix to Excel, just use the xlswrite-command of Matlab.
What about the rank condition? which file in the workspace would contain the info about the rank condition for each case? Could I write that to excel using xlswrite too? Also why did it record infinite eigenvalue as 65535?
When I write oo_.dr.eigval to excel file, it seems that it only writes the real part of the eigenvalues instead of the modulus part. How could I make it write the modulus part?
Also, the xlswrite function requires specifying which cell you want to write to. Since I’m doing a loop, I want matlab to keep writing to the next cell, let’s say to the right. But the argument for the cell you want to write to is a string. How do I keep write to the next cell in row then? Right now I can only write to different sheets when I run the loop since the argument for the sheet number is an integer.
Failure of the rank conditions is coded in the info-variable returned by stoch_simul (see print_info.m for the error codes). If info is not 0, there was an issue. Excel has no code for infinity and uses the maximum value for its integers, which is 65535
If you are only interested in the modulus, write abs(oo_.dr.eigval) to Excel file.
You can use the num2str command of Matlab to convert numbers to strings:
So how can I write the result of the rank condition to the excel file using write function of matlab? Which array should I use?
Also, is there a way that I could write the array horizontally to excel instead of vertically? Right now it only writes vertically but since I have so many cases for the parameters, when it comes to column with double or tripple letters, it is going to be nasty to do the coding. I can code it to write horizontally but everytime it has to write one element of the array instead of the array as a whole and so it is taking too much time. Is there a better solution to this, like a command to write immediately to the next column or a command to write the entire array as a whole but horizontally?
You can just write the variable “info” returned by stoch_simul to Excel. It will contain the error codes
The code I posted above should exactly do that. If you write a row vector to Excel, it will be written horizontally. As dr.eigval is a column vector, you have to use its transpose as indicated above.