It's not a pointer

Please, run the following to see some strange behavior

1) run
<hansl>

open keane.gdt -q
series lp_mfx_print = normal()

include lp-mfx.gfn
smpl (year==87) --restrict
logit status 0 educ exper expersq black --multinomial -q
bundle b = mlogit_mfx(status, $xlist, $coeff, $vcv, $sample)

<hansl>
Then press b icon at session icon view

2) run
<hansl>
open keane.gdt -q
series lp_mfx_print = normal()

include lp-mfx.gfn
smpl (year==87) --restrict
logit status 0 educ exper expersq black --multinomial -q
bundle b = mlogit_mfx(status, $xlist, $coeff, $vcv, $sample)
# here press b icon
catch  lp_mfx_print(&b)
delete lp_mfx_print
# here press b icon again
lp_mfx_print(&b)
<hansl>

3)
<hansl>
open keane.gdt -q
series lp_mfx_print = normal()

include lp-mfx.gfn
smpl (year==87) --restrict
logit status 0 educ exper expersq black --multinomial -q
bundle b = mlogit_mfx(status, $xlist, $coeff, $vcv, $sample)
catch eval lp_mfx_print(&b)
# here press b icon again
<hansl>
Currently, I have no Idea, how to comment
but in the process of executing several
strange phenomenons are seen

Oleh



24 жовтня 2018, 16:24:46, від oleg_komashko@ukr.net:

Dear all,
In "shadowing" thread, Allin (correctly) noticed
that there is a situation where it is difficult to
distinguish between series(int_lag) and function series (int_argument)
1) my suggested answer is incorrect, since we can
have

function series name (int i)
and
function list name (int i)

In this case it is impossible to distinguish
between name(int_lag) and name(int_arg)

The worse (note that I have obtained the
same on Windows10, 2018c and Ubuntu18.04,
today's Git
<hansl>
include lp-mfx.gfn

open keane.gdt -q
# the following line simulate the
situation when a data file
already has 'mlogit_mfx' series
series mlogit_mfx = normal()
smpl (year==87) --restrict
logit status 0 educ exper expersq black --multinomial -q
bundle b = mlogit_mfx(status, $xlist, $coeff, $vcv, $sample)
lp_mfx_print(&b)

catch list z = mlogit_mfx(-1 to -2)
ser = mlogit_mfx
eval mean(ser(-1))

########### output

? open keane.gdt -q
Read datafile /usr/local/share/gretl/data/misc/keane.gdt
? series mlogit_mfx = normal()
Generated series mlogit_mfx (ID 19)
? smpl (year==87) --restrict
Full data set: 12723 observations
Current sample: 1738 observations
? logit status 0 educ exper expersq black --multinomial -q
? bundle b = mlogit_mfx(status, $xlist, $coeff, $vcv, $sample)
? lp_mfx_print(&b)

Multinomial logit marginal effects
(evaluated at means of regressors)

note: dp/dx based on discrete change for black

Outcome 1: (status = 1, Pr = 0.0304)

              dp/dx        s.e.           z        pval        xbar
  educ     0.010826   0.0018373      5.8924  3.8069e-09      12.549
 exper    -0.020829   0.0054490     -3.8225  0.00013211      3.4403
expersq    0.0019936  0.00073506      2.7122   0.0066841      17.199
 black    -0.011001   0.0076838     -1.4318     0.15221     0.37973

Outcome 2: (status = 2, Pr = 0.1434)

              dp/dx        s.e.           z        pval        xbar
  educ    -0.045462   0.0039535     -11.499  1.3298e-30      12.549
 exper     -0.11360    0.012550     -9.0517  1.4080e-19      3.4403
expersq    0.0076209   0.0016081      4.7392  2.1456e-06      17.199
 black     0.065872    0.019682      3.3468  0.00081740     0.37973

Outcome 3: (status = 3, Pr = 0.8263)

              dp/dx        s.e.           z        pval        xbar
  educ     0.034636   0.0042808      8.0911  5.9137e-16      12.549
 exper      0.13443    0.013542      9.9268  3.1829e-23      3.4403
expersq   -0.0096146   0.0017275     -5.5654  2.6150e-08      17.199
 black    -0.054870    0.020909     -2.6243   0.0086834     0.37973

? catch list z = mlogit_mfx(-1 to -2)
> z = mlogit_mfx(-1 to
The symbol 'to' is undefined
? ser = mlogit_mfx
Generated series ser (ID 20)
? eval mean(ser(-1))
-0.017113513

We see that both running package functions
and 'ser = mlogit_mfx' worked ok
But in 'list z = mlogit_mfx(-1 to -2)'

'mlogit_mfx' is interpreted as function

In my opinion this phenomenon can easily be
avoided since no function can have -1 to -2 as
argument

Much worse is mlogit_mfx(-1)
A possible solution is deprecating mlogit_mfx(-1)
and substitution for mlogit_mfx(-1 to -1)

To the contrast,
<hansl>
open keane.gdt -q
series lp_mfx_print = normal()

include lp-mfx.gfn
smpl (year==87) --restrict
logit status 0 educ exper expersq black --multinomial -q
bundle b = mlogit_mfx(status, $xlist, $coeff, $vcv, $sample)
lp_mfx_print(&b)
<hansl>
Note the difference between the two scripts:
1-st a series have the same name with mlogit_mfx()
2-nd a series have the same name with lp_mfx_print()
The rest is the same
Also note that confusing named series are not inserted anywhere
Here I have

? open keane.gdt -q
Read datafile /usr/local/share/gretl/data/misc/keane.gdt
? series lp_mfx_print = normal()
Generated series lp_mfx_print (ID 19)
? include lp-mfx.gfn
/home/oleh/.gretl/functions/lp-mfx.gfn
lp-mfx 0.4, 2016-11-10 (Allin Cottrell)
? smpl (year==87) --restrict
Full data set: 12723 observations
Current sample: 1738 observations
? logit status 0 educ exper expersq black --multinomial -q
? bundle b = mlogit_mfx(status, $xlist, $coeff, $vcv, $sample)
? lp_mfx_print(&b)
> lp_mfx_print(&b)
Incomplete expression
Syntax error

Error executing script: halting
> lp_mfx_print(&b)

May be, a pointer argument?
So we need at least two corrections
1) some functions stop working
2) something should be done with series(int_lag)
Oleh







_______________________________________________
Gretl-devel mailing list
Gretl-devel@lists.wfu.edu
http://lists.wfu.edu/mailman/listinfo/gretl-devel