-
Notifications
You must be signed in to change notification settings - Fork 2
Input‐Output information
By means of the open
command, Gretl can open various file types as a dataset
Here is a simple example for opening a csv-dataset. First, a string is defined which is substituted via the @
symbol:
string filename = "PATH + FILENAME.csv"
open "@filename
Might be useful for storing numeric output in matrix form. See the mwrite
command for details.
You can easily store a matrix as a csv file. The advantage is that you can read-in that format easily into Excel or Gretl again. Here is an example on how store a matrix:
matrix m = mnormal(3, 2)
string filename = "PATH+FILENAME.csv"
store "@filename" --matrix=m
This stored matrix in csv format can be opened as a dataset again:
string filename = "PATH+FILENAME.csv"
open "@filename" --preserve
Assume you print some string, matrix or some other Gretl object. You store the textual printout as a txt-file by means of the outfile
command. The example prints the values of a matrix to the txt-file:
matrix m = mnormal(3, 2)
string filename = "PATH+FILENAME.txt"
outfile "@filename
printf "%12.2f\n", m
end outfile
The eqnprint
command must follow the estimation of a model, and prints the estimated model in the form of a LaTeX equation:
open abdata.gdt --quiet
ols ys const n w --quiet
tabprint --output="./output/regression_equation.tex"
The tabprint
command must follow the estimation of a model. Prints the model in tabular form. The format is governed by the extension of the specified filename: .tex
for LaTeX, .rtf
for RTF (Microsoft's Rich Text Format), or .csv
for comma-separated.
open abdata.gdt --quiet --preserve
ols ys const n w --simple
tabprint --output="./output/regression_output.rtf"
By means of a so called model table, one can summarize estimation results of different specifications. However, the dependent variable must be the same for all models. See the help on the [modeltab
](https://gretl.sourceforge.net/gretl-help/cmdref.html#modeltab) command for details. An example adding three specifications to the table follows. The modelstab show
command prints the output on the screen but which can be stored, too:
open abdata.gdt --quiet --preserve
m1 <- ols ys const --quiet
modeltab add
m2 <- ols ys const n --quiet
modeltab add
m3 <- ols ys const n w --quiet
modeltab add
modeltab show
modeltab --output="./output/regression_table.rtf"
modeltab free
The model table looks like:
Pooled OLS estimates
Dependent variable: ys
(1) (2) (3)
const 4.638*** 4.631*** 4.604***
(0.002926) (0.003712) (0.03510)
n 0.006245*** 0.006269***
(0.002175) (0.002175)
w 0.008756
(0.01110)
n 1031 1031 1031
Adj. R**2 0.0000 0.0070 0.0066
lnL 975.8 979.9 980.2
Standard errors in parentheses
* significant at the 10 percent level
** significant at the 5 percent level
*** significant at the 1 percent level