Gretl export/import from Stata
by cociuba mihai
It's the same.
I also verified the latest modification done in git and have the same.
Maybe is some error from my system, could also someone else test it?
#######################
program define gretl_export
version 8.2
local matrix `1'
local fname `2'
tempname myfile
cd "/home/acer/.gretl"
file open `myfile' using "`fname'", write text replace
local nrows = rowsof(`matrix')
local ncols = colsof(`matrix')
file write `myfile' %8.0g (`nrows') %8.0g (`ncols') _n
forvalues r=1/`nrows' {
forvalues c=1/`ncols' {
file write `myfile' %15.0e (`matrix'[`r',`c']) _n
}
}
file close `myfile'
end
######################
Mihai
On Sun, Nov 20, 2016 at 10:45 PM, cociuba mihai <cociuba(a)gmail.com> wrote:
> Dear Allin,
> the error is still present.
> What kind of other information is necessary in order to eliminate this bug?
>
> ######SCRIPT OUTPUT##################
> gretl version 2016e-git
> Current session: 2016-11-20 22:41
>
> ? function matrix stata_reorder (matrix se)
> > # stata puts the intercept last, but gretl puts it first
> > scalar n = rows(se)
> > return se[n] | se[1:n-1]
> > end function
> ? open data4-1
>
> Read datafile /usr/local/share/gretl/data/data4-1.gdt
> periodicity: 1, maxobs: 14
> observations range: 1 to 14
>
> Listing 5 variables:
> 0) const 1) price 2) sqft 3) bedrms 4) baths
>
> ? ols 1 0 2 3 --cluster=bedrms --quiet
> ? matrix se = $stderr
> Generated matrix se
> ? foreign language=stata --send-data
> ? regress price sqft bedrms, vce(cluster bedrms)
> ? matrix vcv = e(V)
> ? gretl_export vcv "vcv.mat"
> ? end foreign
> ? matrix stata_vcv = mread("vcv.mat", 1)
> /home/acer/.gretl/vcv.mat: No such file or directory
>
> Error executing script: halting
> > matrix stata_vcv = mread("vcv.mat", 1)
> #################################
>
> ########TERMINAL OUTPUT#############
> acer@acer:~$ gretl
> gretl_invert_symmetric_matrix: dpotrf failed with info = 2 (n = 2)
> wald_test: couldn't invert C
> gretl_clipboard_get: info = 0 (TARGET_UTF8_STRING)
> #######################################
>
> Sometime ago there was a discussion about implementing some kind of
> automatic testing of Gretl, on Ubuntu 14.04 I can test the export/import
> functions with other programs (Stata, R, Python, Octave, Julia, not Ox).
>
> Best regards,
>
>
> Mihai
>
> On Sun, Nov 20, 2016 at 6:14 PM, cociuba mihai <cociuba(a)gmail.com> wrote:
>
>> There is an error with Gretl when I try to replicate the example from the
>> Gretl User's Guide (pg 334) :
>>
>> ######SCRIPT OUTPUT############
>> gretl version 2016d-git
>> Current session: 2016-11-20 18:07
>>
>> ? clear
>> ? function matrix stata_reorder (matrix se)
>> > # stata puts the intercept last, but gretl puts it first
>> > scalar n = rows(se)
>> > return se[n] | se[1:n-1]
>> > end function
>> ? open data4-1
>>
>> Read datafile /usr/local/share/gretl/data/data4-1.gdt
>> periodicity: 1, maxobs: 14
>> observations range: 1 to 14
>>
>> Listing 5 variables:
>> 0) const 1) price 2) sqft 3) bedrms 4) baths
>>
>> ? ols 1 0 2 3 --cluster=bedrms --quiet
>> ? matrix se = $stderr
>> Generated matrix se
>> ? foreign language=stata --send-data
>> ? regress price sqft bedrms, vce(cluster bedrms)
>> ? matrix vcv = e(V)
>> ? gretl_export vcv "vcv.mat"
>> ? end foreign
>> ? matrix stata_vcv = mread("vcv.mat", 1)
>> */home/acer/.gretl/vcv.mat: No such file or directory*
>>
>> Error executing script: halting
>> > matrix stata_vcv = mread("vcv.mat", 1)
>> #######################################
>>
>> - the dot director exist
>> ##########GRETL DIRECTOR############
>> acer@acer:~$ cd .gretl/
>> acer@acer:~/.gretl$ pwd
>> /home/acer/.gretl
>> acer@acer:~/.gretl$ ls
>> compon.csv gpttmp.kRPJQj gretltmp.jl script_tmp.08tBiL
>> script_tmp.fH2c3x script_tmp.lmwIi7 script_tmp.SDu1uC showtmp.gp
>> doc gpttmp.vNWs9T gretltmp.png.bounds script_tmp.0qxCKH
>> script_tmp.FiodQ2 script_tmp.mdGpfs script_tmp.T5lpwP stata.csv
>> functions gpttmp.w6tnhh jl_b.mat script_tmp.4sXxvr
>> script_tmp.FuYyq5 script_tmp.MnzzyQ script_tmp.ubbdKr tramo
>> gpttmp.A309zn gretl_export.ado open-4632 script_tmp.aQ8Mia
>> script_tmp.GJfKGn script_tmp.NhnoKm script_tmp.vT5Noz vars.mat
>> gpttmp.AfY5zF gretl_io.jl prntmp.nrWysK script_tmp.bcxUDI
>> script_tmp.HF9rLR script_tmp.njfZCT script_tmp.wAsoT6 x12arima
>> gpttmp.aLCHiG gretl.pid prntmp.Qhvpyb script_tmp.CNWdT6
>> script_tmp.hTxWvo script_tmp.nmD6ly script_tmp.wbzhn8 X.mat
>> gpttmp.dKmY6T gretl.Rprofile Rdata.tmp script_tmp.DsZbBC
>> script_tmp.Ja8fPT script_tmp.QipqMD script_tmp.xu34j4 y.mat
>> gpttmp.HubTrr gretltmp.do Rsrc script_tmp.e7FExz
>> script_tmp.KcvwOr script_tmp.sdgSMS script_tmp.zwfFsk
>> acer@acer:~/.gretl$
>> ################################################
>>
>>
>> In the case that I run the script (gretl_export)from http://list
>> s.wfu.edu/pipermail/gretl-devel/2013-April/004417.html in Stata the
>> matrix is saved in the user director /home/acer.
>>
>> This is on the same Ubuntu 14.04.
>> Mihai
>>
>
>
8 years, 1 month
Gretl export/import from Stata
by cociuba mihai
There is an error with Gretl when I try to replicate the example from the
Gretl User's Guide (pg 334) :
######SCRIPT OUTPUT############
gretl version 2016d-git
Current session: 2016-11-20 18:07
? clear
? function matrix stata_reorder (matrix se)
> # stata puts the intercept last, but gretl puts it first
> scalar n = rows(se)
> return se[n] | se[1:n-1]
> end function
? open data4-1
Read datafile /usr/local/share/gretl/data/data4-1.gdt
periodicity: 1, maxobs: 14
observations range: 1 to 14
Listing 5 variables:
0) const 1) price 2) sqft 3) bedrms 4) baths
? ols 1 0 2 3 --cluster=bedrms --quiet
? matrix se = $stderr
Generated matrix se
? foreign language=stata --send-data
? regress price sqft bedrms, vce(cluster bedrms)
? matrix vcv = e(V)
? gretl_export vcv "vcv.mat"
? end foreign
? matrix stata_vcv = mread("vcv.mat", 1)
*/home/acer/.gretl/vcv.mat: No such file or directory*
Error executing script: halting
> matrix stata_vcv = mread("vcv.mat", 1)
#######################################
- the dot director exist
##########GRETL DIRECTOR############
acer@acer:~$ cd .gretl/
acer@acer:~/.gretl$ pwd
/home/acer/.gretl
acer@acer:~/.gretl$ ls
compon.csv gpttmp.kRPJQj gretltmp.jl script_tmp.08tBiL
script_tmp.fH2c3x script_tmp.lmwIi7 script_tmp.SDu1uC showtmp.gp
doc gpttmp.vNWs9T gretltmp.png.bounds script_tmp.0qxCKH
script_tmp.FiodQ2 script_tmp.mdGpfs script_tmp.T5lpwP stata.csv
functions gpttmp.w6tnhh jl_b.mat script_tmp.4sXxvr
script_tmp.FuYyq5 script_tmp.MnzzyQ script_tmp.ubbdKr tramo
gpttmp.A309zn gretl_export.ado open-4632 script_tmp.aQ8Mia
script_tmp.GJfKGn script_tmp.NhnoKm script_tmp.vT5Noz vars.mat
gpttmp.AfY5zF gretl_io.jl prntmp.nrWysK script_tmp.bcxUDI
script_tmp.HF9rLR script_tmp.njfZCT script_tmp.wAsoT6 x12arima
gpttmp.aLCHiG gretl.pid prntmp.Qhvpyb script_tmp.CNWdT6
script_tmp.hTxWvo script_tmp.nmD6ly script_tmp.wbzhn8 X.mat
gpttmp.dKmY6T gretl.Rprofile Rdata.tmp script_tmp.DsZbBC
script_tmp.Ja8fPT script_tmp.QipqMD script_tmp.xu34j4 y.mat
gpttmp.HubTrr gretltmp.do Rsrc script_tmp.e7FExz
script_tmp.KcvwOr script_tmp.sdgSMS script_tmp.zwfFsk
acer@acer:~/.gretl$
################################################
In the case that I run the script (gretl_export)from
http://lists.wfu.edu/pipermail/gretl-devel/2013-April/004417.html in
Stata the matrix is saved in the user director /home/acer.
This is on the same Ubuntu 14.04.
Mihai
8 years, 1 month
error when building Gretl from git
by cociuba mihai
I'm having the following error when trying to build Gretl from sources:
* make -j2*
"
./builddate
make -C po
build.h is current
make -C xdg
make[1]: Entering directory `/home/acer/gretl-git/po'
make[1]: Entering directory `/home/acer/gretl-git/xdg'
make[1]: Nothing to be done for `all'.
make[1]: Leaving directory `/home/acer/gretl-git/xdg'
/usr/bin/msgmerge --update bg.po gretl.pot
/usr/bin/msgmerge --update ca.po gretl.pot
...............................................................................................................................................................................................................................................................................................................................................................................................................
done.
make -C lib
...............................................................................................................................................................................................................................................................................................................................................................................................................
done.
/usr/bin/msgmerge --update cs.po gretl.pot
make[1]: Entering directory `/home/acer/gretl-git/lib'
make[1]: *** No rule to make target `../lib/src/asa047_mod.c', needed by
`gretl_bfgs.lo'. Stop.
make[1]: Leaving directory `/home/acer/gretl-git/lib'
........make: *** [lib] Error 2
...make: ............*** Waiting for unfinished jobs.....
............................................................................................................................................................................................................................................................................................................................................./usr/bin/msgmerge
--update de.po gretl.pot
............................................. done.
/usr/bin/msgmerge --update el.po gretl.pot
.................................................................................................................................................................................................................................................................................................................................................................................................................
done.
.........................................................................................................................................................................................................................................................................................................................................................................../usr/bin/msgmerge
--update es.po gretl.pot
..................................................................... done.
/usr/bin/msgmerge --update eu.po gretl.pot
....................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
done.
done.
/usr/bin/msgmerge --update fr.po gretl.pot
....................................................................................................................................................................................................................................................................................................................................................................................................................
done.
make[1]: Leaving directory `/home/acer/gretl-git/po'"
Any thoughts on what may be the problem?
Until now the builds were ok on this machine (Ubuntu 14.04), and the
configure command doesn't show any errors.
8 years, 1 month
how to set the dataset info?
by Sven Schreiber
Hi,
a basic question (and admittedly not super-important); is it possible to
set the free-format comment of the dataset/workfile in a script? That
is, the scripting equivalent to menu Data -> Dataset info.
I couldn't find it in the help. The command "setinfo" would seem
natural, but it's only for individual series. So syntax-wise something like:
setinfo --dataset=stringvar_or_literal
or alternatively:
dataset setinfo stringvar_or_literal
(BTW, unrelated to the question here: "dataset clear" and "clear" seem
to be synonyms, whereas "clear --dataset" seems slightly different.
Perhaps the old form "dataset clear" is slightly misleading nowadays and
might be deprecated?)
thanks,
sven
8 years, 1 month
random number generation
by Allin Cottrell
Hello all,
Some news and a warning.
For some time now we've been using the Marsaglia-Tsang "Ziggurat"
algorithm for generating (pseudo-)random normal variates. Recently,
Jack noticed that we were considerably slower than Octave at doing
this, so we compared the respective codes.
It turned out that the Octave Ziggurat code (written by David Bateman)
was indeed better than what we had: not only faster, but also gives
denser coverage of the real line. We checked it using l'Ecuyer's "Big
Crush" suite and it passed with flying colors. Therefore in current
git we have switched to Bateman's implementation.
This is a nice improvement, but here's the warning: unfortunately, it
is impossible to preserve the sequence of pseudo-random values
produced for any given seed, across the change in algorithm. So in
current git (and the upcoming 2016d release) you will not get the same
sequences as with gretl 2016c and earlier (back to gretl 1.8.7, when
we last changed the code for generating normals).
If you have Monte Carlo code that runs many replications, results
should be qualitatively very similar, but "single-case" simulations
may produce quite different output for a given seed.
--
Allin Cottrell
Department of Economics
Wake Forest University, NC
8 years, 1 month
Re: [Gretl-users] Sample selection issues
by George Matysiak
> Cannot reproduce that here. Which version, which dataset, which dummy?
sven,
I'm using Version 2016d. Specifically, I have a dataset of 63 observations,
consisting of of 3 different categories each with 21 members. I have
defined a dummy for each sub-set i.e 3 dummies. So, I first select a sample
based on one of the dummies/Use dummy variable/ which gives me a sample of
21. I then select/Random sub-sample/ and receive the message Number of
observations to select (max 62) - it list 10 as the default. If, for
example, I enter 22 I get the message Invalid number of cases 22. If I
click ok again it reports dropped 41 observations. Clearly not appropriate.
Perhaps a few if conditions greater than/less than are required in the code
in order to captures the breaches in the conditions. Thanks.
George
*Contact number +48 781 415 432**"In God we trust, all others bring data."*
8 years, 1 month
Re: [Gretl-users] Sample selection issues
by George Matysiak
When I select a sample using > *Restrict, based in criterion *and then > *Use
dummy variable* all works fine, and I get the appropriate sub-set. When I
then select > *Random sub-sample* from this subset, everything is fine as
long as the number selected is less than the number of items that were
selected on the first call.
However, there is a misleading message *Number of observations to select
(max x)*, where x is greater than the number of observations that were
selected on the first call. Furthermore, if I specify a number larger than
the number of obs that were selected, it executes the specified x. However,
on occasions I do get the message *Invalid number of cases*. If I re-enter
the same x then it goes through. It appears there's a problem in trapping
this. Thanks.
*"In God we trust, all others bring data."*
8 years, 1 month