[Gretl-users] Gretl export/import from Stata

cociuba mihai cociuba at gmail.com
Sun Nov 20 17:32:14 EST 2016


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 at 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 at 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 at 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 at acer:~$ cd .gretl/
>> acer at acer:~/.gretl$ pwd
>> /home/acer/.gretl
>> acer at 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 at 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
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.wfu.edu/pipermail/gretl-users/attachments/20161121/0f62b793/attachment-0001.html>


More information about the Gretl-users mailing list