Daniel Bencik | 18 Jan 19:44 2015
Picon

Missing values in MLE

Dear group, 

 

trying to estimate a W-CARR(2,2) model on volatility time series using mle, I run into "Missing values encoutered" even though

 1/ W-CARR(1,1) any many other (1,1)-specification models work just fine on the same dataset

 2/ the dataset is checked to contain no NAs

 

I read the user manual, section Missing values, also tried googling, but found no real help, so I humbly ask for direction here. The smallest amount of working code that shows the MLE is 

 

<hansl>

smpl full

 

# base values of estimates

scalar c_ = 0.000145655

scalar rng = 0.103050

scalar rng2 = 0.0987507

scalar err_ = -0.0964818

scalar err_2 = 0.872122

 

scalar xFirstObs = 5

scalar xLastObs = xOosEstimationWindowSize

scalar xFcastedPeriod = -1

 

# having the combination of explained and explanatory variables, we create out of sample forecasts

loop xFcastedPeriod = xLastObs + 1 .. $nobs - 1  --quiet

    smpl xFirstObs xLastObs # set data range

 

    mle ll =  -ln(lambda) - sqrtPark/lambda

        series lambda = mean(sqrtPark)

        series lambda = c_ + rng * sqrtPark(-1) + rng2 * sqrtPark(-2) + err_ * lambda(-1) + err_2 * lambda(-2)

 

        params c_ rng rng2 err_ err_2

    end mle --robust

 

    xFirstObs = xFirstObs + 1

    xLastObs = xLastObs + 1

endloop

</hansl>

 

Any help is much appreciated, 

Daniel 

 

<div>
<p>Dear group,&nbsp;</p>

<p>&nbsp;</p>

<p>trying to estimate a W-CARR(2,2) model on volatility time series using mle, I run into "Missing values encoutered" even though</p>

<p>&nbsp;1/ W-CARR(1,1) any many other (1,1)-specification models work just fine on the same dataset</p>

<p>&nbsp;2/ the dataset is checked to contain no NAs</p>

<p>&nbsp;</p>

<p>I read the user manual, section Missing values, also tried googling, but found no real help, so I humbly ask for direction here. The smallest amount of working code that shows the MLE is&nbsp;</p>

<p>&nbsp;</p>

<p>&lt;hansl&gt;</p>

<p>smpl full</p>

<p>&nbsp;</p>

<p># base values of estimates</p>

<p>scalar c_ = 0.000145655</p>

<p>scalar rng = 0.103050</p>

<p>scalar rng2 = 0.0987507</p>

<p>scalar err_ = -0.0964818</p>

<p>scalar err_2 = 0.872122</p>

<p>&nbsp;</p>

<p>scalar xFirstObs = 5<span class="Apple-tab-span"> </span></p>

<p>scalar xLastObs = xOosEstimationWindowSize</p>

<p>scalar xFcastedPeriod = -1</p>

<p>&nbsp;</p>

<p># having the combination of explained and explanatory variables, we create out of sample forecasts</p>

<p>loop xFcastedPeriod = xLastObs + 1 .. $nobs - 1 &nbsp;--quiet</p>

<p>&nbsp; &nbsp; smpl xFirstObs xLastObs <span class="Apple-tab-span"> </span># set data range</p>

<p>&nbsp;</p>

<p>&nbsp; &nbsp; mle ll = &nbsp;-ln(lambda) - sqrtPark/lambda</p>

<p>&nbsp; &nbsp; &nbsp; &nbsp; series lambda = mean(sqrtPark)</p>

<p>&nbsp; &nbsp; &nbsp; &nbsp; series lambda = c_ + rng * sqrtPark(-1) + rng2 * sqrtPark(-2) + err_ * lambda(-1) + err_2 * lambda(-2)</p>

<p>&nbsp;</p>

<p>&nbsp; &nbsp; &nbsp; &nbsp; params c_ rng rng2 err_ err_2</p>

<p>&nbsp; &nbsp; end mle --robust</p>

<p>&nbsp;</p>

<p>&nbsp; &nbsp; xFirstObs = xFirstObs + 1</p>

<p>&nbsp; &nbsp; xLastObs = xLastObs + 1</p>

<p>endloop</p>

<div>&lt;/hansl&gt;</div>
<p>&nbsp;</p>

<p>Any help is much appreciated,&nbsp;</p>

<p>Daniel&nbsp;</p>

<p>&nbsp;</p>
</div>
Artur T. | 16 Jan 16:21 2015

error: read out varname using loop

Hi all,

in the past this used to work:

<hansl>
open denmark.gdt -q
list X = LRM LRY
loop i=1..2 -q
     string vname = varname(X[i])
    print vname
endloop
</hansl>

However, using current cvs on Ubuntu, I get the error:
"varname: argument should be scalar, is series
Data types not conformable for operation"

Did I miss some recent changes, or is it a bug?

Artur
Henrique Andrade | 14 Jan 16:06 2015
Picon

Feature Request: "--preserve" option

Dear Gretl Team,

We can use the option "--preserve" with the "open" command to preserve matrices and scalars. I would like to ask you if it is possible to include strings too (so the "preserve" option will preserve matrices, scalars, and strings).

Best regards,
Henrique Andrade
<div><div dir="ltr">Dear Gretl Team,<div><br></div>
<div>We can use the option "--preserve" with the "open" command to preserve matrices and scalars. I would like to ask you if it is possible to include strings too (so the "preserve" option will preserve matrices, scalars, and strings).<br clear="all"><div><br></div>
<div>Best regards,</div>
<div>
<span>Henrique Andrade</span><br>
</div>
</div>
</div></div>
Logan Kelly | 9 Jan 17:01 2015

Serial correlation and omit

Hello,

 

Apologies for a very rudimentary question. Is the joint significance test performed by omit valid in the presence of serial correlation when (i) the --robust option is used to with ols and (ii) the --chi-square option is used with omit, e.g.

 

ols y const x z --robust

omit z --chi-square

 

Thanks,

 

Logan

<div>
<div class="WordSection1">
<p class="MsoNormal">Hello,<p></p></p>
<p class="MsoNormal"><p>&nbsp;</p></p>
<p class="MsoNormal">Apologies for a very rudimentary question. Is the joint significance test performed by omit valid in the presence of serial correlation when (i) the --robust option is used to with ols and (ii) the --chi-square option is used with omit,
 e.g.<p></p></p>
<p class="MsoNormal"><p>&nbsp;</p></p>
<p class="MsoNormal">ols y const x z --robust<p></p></p>
<p class="MsoNormal">omit z --chi-square<p></p></p>
<p class="MsoNormal"><p>&nbsp;</p></p>
<p class="MsoNormal">Thanks,<p></p></p>
<p class="MsoNormal"><p>&nbsp;</p></p>
<p class="MsoNormal">Logan<p></p></p>
</div>
</div>
Daniel Bencik | 6 Jan 22:16 2015
Picon

MLE with lists

Dear forum, 

 

I am struggling with my variable lists once again. I expected the following two ML estimations to give the same results, but they don't. Any ideas? 

 

    #estimation 1

    scalar c_ = 0.1

    scalar rng = 0.1

    scalar err = 0.2

 

    mle ll = -ln(lambda) - sqrtPark/lambda

 

        series lambda = mean(sqrtPark)

        series lambda = c_ + rng * sqrtPark(-1) + err * lambda(-1)

 

        params c_ rng err

    end mle --robust

 

 

    #estimation 2

    list    xDepVars = sqrtPark

    list    xExpVars = sqrtPark(-1) 

 

    c_ = 0.1

    rng = 0.1

    err = 0.2

 

    series xDepVar = xDepVars[1]

    series xExpVar = xExpVars[1]

 

    mle ll2 =  -ln(lambda2) - xDepVar/lambda2

 

        series lambda2 = mean(xDepVar)

        series lambda2 = c_ + rng * xExpVar + err * lambda2(-1)

 

        params c_ rng err

    end mle --robust

 

Many thanks in advance, 

Daniel

<div>
<p>Dear forum,&nbsp;</p>

<p>&nbsp;</p>

<p>I am struggling with my variable lists once again. I expected the following two ML estimations to give the same results, but they don't. Any ideas?&nbsp;</p>

<p>&nbsp;</p>

<p>&nbsp; &nbsp; #estimation 1</p>

<p>&nbsp; &nbsp; scalar c_ = 0.1</p>

<p>&nbsp; &nbsp; scalar rng = 0.1</p>

<p>&nbsp; &nbsp; scalar err = 0.2</p>

<p>&nbsp;</p>

<p>&nbsp; &nbsp; mle ll = -ln(lambda) - sqrtPark/lambda</p>

<p>&nbsp;</p>

<p>&nbsp; &nbsp; &nbsp; &nbsp; series lambda = mean(sqrtPark)</p>

<p>&nbsp; &nbsp; &nbsp; &nbsp; series lambda = c_ + rng * sqrtPark(-1) + err * lambda(-1)</p>

<p>&nbsp;</p>

<p>&nbsp; &nbsp; &nbsp; &nbsp; params c_ rng err</p>

<p>&nbsp; &nbsp; end mle --robust</p>

<p>&nbsp;</p>

<p>&nbsp;</p>

<p>&nbsp; &nbsp; #estimation 2</p>

<p><span>&nbsp; &nbsp; list &nbsp; &nbsp;xDepVars = sqrtPark</span></p>

<p>&nbsp; &nbsp; list &nbsp; &nbsp;xExpVars = sqrtPark(-1)&nbsp;</p>

<p>&nbsp;</p>

<p>&nbsp; &nbsp; c_ = 0.1</p>

<p>&nbsp; &nbsp; rng = 0.1</p>

<p>&nbsp; &nbsp; err = 0.2</p>

<p>&nbsp;</p>

<p>&nbsp; &nbsp; series xDepVar = xDepVars[1]</p>

<p>&nbsp; &nbsp; series xExpVar = xExpVars[1]</p>

<p>&nbsp;</p>

<p>&nbsp; &nbsp; mle ll2 = &nbsp;-ln(lambda2) - xDepVar/lambda2</p>

<p>&nbsp;</p>

<p>&nbsp; &nbsp; &nbsp; &nbsp; series lambda2 = mean(xDepVar)</p>

<p>&nbsp; &nbsp; &nbsp; &nbsp; series lambda2 = c_ + rng * xExpVar + err * lambda2(-1)</p>

<p>&nbsp;</p>

<p>&nbsp; &nbsp; &nbsp; &nbsp; params c_ rng err</p>

<p>&nbsp; &nbsp; end mle --robust</p>

<p>&nbsp;</p>

<p>Many thanks in advance,&nbsp;</p>

<p>Daniel</p>
</div>
Summers, Peter | 6 Jan 19:10 2015

ordered probit

Folks,

 

This is an econometrics question rather than a Gretl question, so apologies in advance.

 

I’ve estimated an ordered probit on a panel data set with lagged regressors. Gretl seems to automatically include the same number of lags of the dependent variable, and I’m wondering why that is. So far I haven’t been able to find a reference for this – nothing in the user’s guide, Lee’s ebook, or Greene, AFAICS. If anyone could help me out, I’d appreciate it.

 

Thanks!

PS

 

 

<div>
<div class="WordSection1">
<p class="MsoNormal">Folks,<p></p></p>
<p class="MsoNormal"><p>&nbsp;</p></p>
<p class="MsoNormal">This is an econometrics question rather than a Gretl question, so apologies in advance.<p></p></p>
<p class="MsoNormal"><p>&nbsp;</p></p>
<p class="MsoNormal">I&rsquo;ve estimated an ordered probit on a panel data set with lagged regressors. Gretl seems to automatically include the same number of lags of the dependent variable, and I&rsquo;m wondering why that is. So far I haven&rsquo;t been able to find a reference
 for this &ndash; nothing in the user&rsquo;s guide, Lee&rsquo;s ebook, or Greene, AFAICS. If anyone could help me out, I&rsquo;d appreciate it.<p></p></p>
<p class="MsoNormal"><p>&nbsp;</p></p>
<p class="MsoNormal">Thanks!<p></p></p>
<p class="MsoNormal">PS<p></p></p>
<p class="MsoNormal"><p>&nbsp;</p></p>
<p class="MsoNormal"><p></p></p>
<p class="MsoNormal"><p>&nbsp;</p></p>
</div>
</div>
Summers, Peter | 6 Jan 18:03 2015

modeltab error

Hi all,

 

According to the ‘modeltab’ help (and previous forum postings), the following should work:

<hansl>

(estimate various models & add them to model table)

modeltab show

modeltab --output=”outputfile.tex”

</hansl>

 

However, the second line generates the error “Command has insufficient arguments.” If I try “modeltab show --output=”outputfile.tex”, I get a “Syntax error” instead. This is on Windows 7, v1.10.0 CVS, build date 2014-12-09.

 

TIA,

 

PS

 

 

<div>
<div class="WordSection1">
<p class="MsoNormal">Hi all,<p></p></p>
<p class="MsoNormal"><p>&nbsp;</p></p>
<p class="MsoNormal">According to the &lsquo;modeltab&rsquo; help (and previous forum postings), the following should work:<p></p></p>
<p class="MsoNormal">&lt;hansl&gt;<p></p></p>
<p class="MsoNormal">(estimate various models &amp; add them to model table)<p></p></p>
<p class="MsoNormal">modeltab show<p></p></p>
<p class="MsoNormal">modeltab --output=&rdquo;outputfile.tex&rdquo;<p></p></p>
<p class="MsoNormal">&lt;/hansl&gt;<p></p></p>
<p class="MsoNormal"><p>&nbsp;</p></p>
<p class="MsoNormal">However, the second line generates the error &ldquo;Command has insufficient arguments.&rdquo; If I try &ldquo;modeltab show --output=&rdquo;outputfile.tex&rdquo;, I get a &ldquo;Syntax error&rdquo; instead. This is on Windows 7, v1.10.0 CVS, build date 2014-12-09.<p></p></p>
<p class="MsoNormal"><p>&nbsp;</p></p>
<p class="MsoNormal">TIA,<p></p></p>
<p class="MsoNormal"><p>&nbsp;</p></p>
<p class="MsoNormal">PS<p></p></p>
<p class="MsoNormal"><p>&nbsp;</p></p>
<p class="MsoNormal"><p></p></p>
<p class="MsoNormal"><p>&nbsp;</p></p>
</div>
</div>
Daniel Bencik | 5 Jan 18:10 2015
Picon

Re: Getting a list of variables via an array of their names

Sven, you are right. Thank you.

 

Daniel

______________________________________________________________
> Od: <gretl-users-request-npDYnXcwJHngpn9g0Uvcdg@public.gmane.org>
> Komu: <gretl-users-npDYnXcwJHngpn9g0Uvcdg@public.gmane.org>
> Datum: 05.01.2015 18:03
> Předmět: Gretl-users Digest, Vol 96, Issue 4
>

Send Gretl-users mailing list submissions to
gretl-users-npDYnXcwJHngpn9g0Uvcdg@public.gmane.org

To subscribe or unsubscribe via the World Wide Web, visit
http://lists.wfu.edu/mailman/listinfo/gretl-users
or, via email, send a message with subject or body 'help' to
gretl-users-request-npDYnXcwJHngpn9g0Uvcdg@public.gmane.org

You can reach the person managing the list at
gretl-users-owner-npDYnXcwJHngpn9g0Uvcdg@public.gmane.org

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Gretl-users digest..."


Today's Topics:

  1. Re: Getting a list of variables via an array of their names
     (Daniel Bencik)
  2. Re: Getting a list of variables via an array of their names
     (Sven Schreiber)


----------------------------------------------------------------------

Message: 1
Date: Sun, 04 Jan 2015 18:38:48 +0100
From: Daniel Bencik <eubie-aRb0bU7PRFPrBKCeMvbIDA@public.gmane.org>
Subject: Re: [Gretl-users] Getting a list of variables via an array of
their names
To: "gretl-users" <gretl-users-npDYnXcwJHngpn9g0Uvcdg@public.gmane.org>
Message-ID: <20150104183848.9B5E135E-aRb0bU7PRFPrBKCeMvbIDA@public.gmane.org>
Content-Type: text/plain; charset="utf-8"

Sven,?
?
thanks a lot. The ternary operator - beautiful.?
?
To the questions ... I do have four dataset (variance, volatility, logVariance, logVolatility) each with approx 100 series, so I do not want to merge them into one dataset. The idea is to have four sessions, into each session I load the specific dataset and then run a script that estimates a lot of models on the current dataset and produces models/fitted values into the current session. Like this, I get to have all the variables/models/fits/etc in each separate session. For this purpose, I want to have one script instead of four, that is the gist of the idea.?
?
The simplest piece of code that reproduces the error I get is the following snippet:
?
open anscombe.gdt
?
strings xNames = array(2)
? ? ? ? xNames[1] = "x"
? ? ? ? xNames[2] = "y1"
? ? ? ??
list xVariables = <at> xNames[1] <at> xNames[2]
?
Thank you!
Daniel

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.wfu.edu/pipermail/gretl-users/attachments/20150104/15d0f693/attachment-0001.html

------------------------------

Message: 2
Date: Sun, 04 Jan 2015 18:49:39 +0100
From: Sven Schreiber <svetosch-hi6Y0CQ0nG0@public.gmane.org>
Subject: Re: [Gretl-users] Getting a list of variables via an array of
their names
To: gretl-users-npDYnXcwJHngpn9g0Uvcdg@public.gmane.org
Message-ID: <54A97D33.2020001-hi6Y0CQ0nG0@public.gmane.org>
Content-Type: text/plain; charset=windows-1252

Am 04.01.2015 um 18:38 schrieb Daniel Bencik:

>  
>
> The simplest piece of code that reproduces the error I get is the
> following snippet:
>
>  
>
> /open anscombe.gdt/
>
>  
>
> /strings xNames = array(2)/
>
> /        xNames[1] = "x"/
>
> /        xNames[2] = "y1"/
>
>        
>
> /list xVariables = <at> xNames[1] <at> xNames[2]/
>
>

Allin explained this already in an answer to you a couple of days ago.

-s



------------------------------

_______________________________________________
Gretl-users mailing list
Gretl-users-npDYnXcwJHngpn9g0Uvcdg@public.gmane.org
http://lists.wfu.edu/mailman/listinfo/gretl-users

End of Gretl-users Digest, Vol 96, Issue 4
******************************************

<div>
<p>Sven, you are right. Thank you.</p>

<p>&nbsp;</p>

<p>Daniel</p>

<p>______________________________________________________________<br>
&gt; Od: &lt;gretl-users-request@...&gt;<br>
&gt; Komu: &lt;gretl-users@...&gt;<br>
&gt; Datum: 05.01.2015 18:03<br>
&gt; P&#345;edm&#283;t: Gretl-users Digest, Vol 96, Issue 4<br>
&gt;</p>

<p>Send Gretl-users mailing list submissions to<br>
 gretl-users@...<br><br>
To subscribe or unsubscribe via the World Wide Web, visit<br><a href="http://lists.wfu.edu/mailman/listinfo/gretl-users">http://lists.wfu.edu/mailman/listinfo/gretl-users</a><br>
or, via email, send a message with subject or body 'help' to<br>
 gretl-users-request@...<br><br>
You can reach the person managing the list at<br>
 gretl-users-owner@...<br><br>
When replying, please edit your Subject line so it is more specific<br>
than "Re: Contents of Gretl-users digest..."<br><br><br>
Today's Topics:<br><br>
 &nbsp; 1. Re: Getting a list of variables via an array of their names<br>
 &nbsp; &nbsp; &nbsp;(Daniel Bencik)<br>
 &nbsp; 2. Re: Getting a list of variables via an array of their names<br>
 &nbsp; &nbsp; &nbsp;(Sven Schreiber)<br><br><br>
----------------------------------------------------------------------<br><br>
Message: 1<br>
Date: Sun, 04 Jan 2015 18:38:48 +0100<br>
From: Daniel Bencik &lt;eubie@...&gt;<br>
Subject: Re: [Gretl-users] Getting a list of variables via an array of<br>
 their names<br>
To: "gretl-users" &lt;gretl-users@...&gt;<br>
Message-ID: &lt;20150104183848.9B5E135E@...&gt;<br>
Content-Type: text/plain; charset="utf-8"<br><br>
Sven,?<br>
?<br>
thanks a lot. The ternary operator - beautiful.?<br>
?<br>
To the questions ... I do have four dataset (variance, volatility, logVariance, logVolatility) each with approx 100 series, so I do not want to merge them into one dataset. The idea is to have four sessions, into each session I load the specific dataset and then run a script that estimates a lot of models on the current dataset and produces models/fitted values into the current session. Like this, I get to have all the variables/models/fits/etc in each separate session. For this purpose, I want to have one script instead of four, that is the gist of the idea.?<br>
?<br>
The simplest piece of code that reproduces the error I get is the following snippet:<br>
?<br>
open anscombe.gdt<br>
?<br>
strings xNames = array(2)<br>
? ? ? ? xNames[1] = "x"<br>
? ? ? ? xNames[2] = "y1"<br>
? ? ? ??<br>
list xVariables =  <at> xNames[1]  <at> xNames[2]<br>
?<br>
Thank you!<br>
Daniel<br><br>
-------------- next part --------------<br>
An HTML attachment was scrubbed...<br>
URL: <a href="http://lists.wfu.edu/pipermail/gretl-users/attachments/20150104/15d0f693/attachment-0001.html">http://lists.wfu.edu/pipermail/gretl-users/attachments/20150104/15d0f693/attachment-0001.html</a> <br><br>
------------------------------<br><br>
Message: 2<br>
Date: Sun, 04 Jan 2015 18:49:39 +0100<br>
From: Sven Schreiber &lt;svetosch@...&gt;<br>
Subject: Re: [Gretl-users] Getting a list of variables via an array of<br>
 their names<br>
To: gretl-users@...<br>
Message-ID: &lt;54A97D33.2020001@...&gt;<br>
Content-Type: text/plain; charset=windows-1252<br><br>
Am 04.01.2015 um 18:38 schrieb Daniel Bencik:<br><br>
&gt; &nbsp;<br>
&gt; <br>
&gt; The simplest piece of code that reproduces the error I get is the<br>
&gt; following snippet:<br>
&gt; <br>
&gt; &nbsp;<br>
&gt; <br>
&gt; /open anscombe.gdt/<br>
&gt; <br>
&gt; &nbsp;<br>
&gt; <br>
&gt; /strings xNames = array(2)/<br>
&gt; <br>
&gt; / &nbsp; &nbsp; &nbsp; &nbsp;xNames[1] = "x"/<br>
&gt; <br>
&gt; / &nbsp; &nbsp; &nbsp; &nbsp;xNames[2] = "y1"/<br>
&gt; <br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; <br>
&gt; <br>
&gt; /list xVariables =  <at> xNames[1]  <at> xNames[2]/<br>
&gt; <br>
&gt;<br><br>
Allin explained this already in an answer to you a couple of days ago.<br><br>
-s<br><br><br><br>
------------------------------<br><br>
_______________________________________________<br>
Gretl-users mailing list<br>
Gretl-users@...<br><a href="http://lists.wfu.edu/mailman/listinfo/gretl-users">http://lists.wfu.edu/mailman/listinfo/gretl-users</a><br><br>
End of Gretl-users Digest, Vol 96, Issue 4<br>
******************************************</p>
</div>
Daniel Bencik | 4 Jan 18:38 2015
Picon

Re: Getting a list of variables via an array of their names

Sven, 

 

thanks a lot. The ternary operator - beautiful. 

 

To the questions ... I do have four dataset (variance, volatility, logVariance, logVolatility) each with approx 100 series, so I do not want to merge them into one dataset. The idea is to have four sessions, into each session I load the specific dataset and then run a script that estimates a lot of models on the current dataset and produces models/fitted values into the current session. Like this, I get to have all the variables/models/fits/etc in each separate session. For this purpose, I want to have one script instead of four, that is the gist of the idea. 

 

The simplest piece of code that reproduces the error I get is the following snippet:

 

open anscombe.gdt

 

strings xNames = array(2)

        xNames[1] = "x"

        xNames[2] = "y1"

        

list xVariables = <at> xNames[1] <at> xNames[2]

 

Thank you!

Daniel

<div>
<p>Sven,&nbsp;</p>

<p>&nbsp;</p>

<p>thanks a lot. The ternary operator - beautiful.&nbsp;</p>

<p>&nbsp;</p>

<p>To the questions ... I do have four dataset (variance, volatility, logVariance, logVolatility) each with approx 100 series, so I do not want to merge them into one dataset. The idea is to have four sessions, into each session I load the specific dataset and then run a script that estimates a lot of models on the current dataset and produces models/fitted values into the current session. Like this, I get to have all the variables/models/fits/etc in each separate session. For this purpose, I want to have one script instead of four, that is the gist of the idea.&nbsp;</p>

<p>&nbsp;</p>

<p>The simplest piece of code that reproduces the error I get is the following snippet:</p>

<p>&nbsp;</p>

<p>open anscombe.gdt</p>

<p>&nbsp;</p>

<p>strings xNames = array(2)</p>

<p>&nbsp; &nbsp; &nbsp; &nbsp; xNames[1] = "x"</p>

<p>&nbsp; &nbsp; &nbsp; &nbsp; xNames[2] = "y1"</p>

<p>&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</p>

<p>list xVariables =  <at> xNames[1]  <at> xNames[2]</p>

<p>&nbsp;</p>

<p>Thank you!</p>

<p>Daniel</p>
</div>
Daniel Bencik | 4 Jan 14:47 2015
Picon

Getting a list of variables via an array of their names

Dear group, 

 

I am sorry to be bothering this mailgroup with such beginner questions, but I have nowhere else to ask and frankly, gretl is too good to pass up. 

 

Lets say I have two time series variance measures "park" and "rr" in my dataset. Having learnt from previous threads, I put both into a list and run a regression ...

 

list xVariables = park rr

ols xVariables[1] 0 xVariables[2]

 

On top of that, I have three other datasets where I have volatility, ln(variance) and ln(volatility), stored e.g. as sqrtpark, sqrtrr, lnpark, lnrr .. etc. What I would love to have is a script, that can run the same battery of HAR models on all four datasets, with the help of some flags. The idea is something like this

 

# define we have the log volatility dataset 

scalar xIsLog = 1

scalar xIsVolatility = 1

 

# produce variable prefixes

string xIsLogPrefix = ""

if xIsLog = 1

  xIsLogPrefix = "ln"

endif

 

string xIsVolatilityPrefix = ""

if xIsVolatility = 1

  xIsVolatilityPrefix = "sqrt"

endif

# create the names of variables

strings xVariableNames = array(2)

xVariableNames[1] = xIsLogPrefix

xVariableNames[1] += xIsVolatilityPrefix

xVariableNames[1] += "park"                                #produce "lnsqrtpark "

xVariableNames[2] = xIsLogPrefix

xVariableNames[2] += xIsVolatilityPrefix

xVariableNames[2] += "rr"                                    #produce "lnsqrtrr"

 

# finally, make a list of variables based on their names

list    xVariables = <at> xVariableNames[1] <at> xVariableNames[2]


The last line produces an error Im unable to graps. Is there a workaround or do I need to have a different script for each dataset? As an additional question, can I somehow get the name of currently opened dataset? If yes, xIsLog and xIsVolatility could be set automatically and it would make the script much more elegant. 

 

Thank you and best regards, 

Daniel

 

<div>
<p>Dear group,&nbsp;</p>

<p>&nbsp;</p>

<p>I am sorry to be bothering this mailgroup with such beginner questions, but I have nowhere else to ask and frankly, gretl is too good to pass up.&nbsp;</p>

<p>&nbsp;</p>

<p>Lets say I have two time series variance measures "park" and "rr" in my dataset. Having learnt from previous threads, I put both into a list and run a regression ...</p>

<p>&nbsp;</p>

<p>list xVariables = park rr</p>

<p>ols&nbsp;<span>xVariables[1] 0&nbsp;</span><span>xVariables[2]</span></p>

<p>&nbsp;</p>

<p>On top of that, I have three other datasets where I have volatility, ln(variance) and ln(volatility), stored e.g. as sqrtpark, sqrtrr, lnpark, lnrr .. etc. What I would love to have is a script, that can run the same battery of HAR models on all four datasets, with the help of some flags. The idea is something like this</p>

<p>&nbsp;</p>

<p># define we have the log volatility dataset&nbsp;</p>

<p>scalar xIsLog = 1</p>

<p>scalar xIsVolatility = 1</p>

<p>&nbsp;</p>

<p># produce variable prefixes</p>

<p>string xIsLogPrefix = ""</p>

<p>if xIsL<span>og = 1</span></p>

<p><span>&nbsp;&nbsp;</span><span>xIsLogPrefix = "ln"</span></p>

<p><span>endif</span></p>

<p>&nbsp;</p>

<p>string xIsVolatilityPrefix = ""</p>

<p>if&nbsp;xIsVolatility<span>&nbsp;= 1</span></p>

<p><span>&nbsp;&nbsp;</span>xIsVolatilityPrefix<span>&nbsp;= "sqrt"</span></p>

<p><span>endif</span></p>

<div># create the names of variables</div>
<p>strings&nbsp;xVariableNames&nbsp;= array(2)</p>

<p>xVariableNames[1] = <span>xIsLogPrefix</span></p>

<p><span></span>xVariableNames[1] +=&nbsp;<span>xIsVolatilityPrefix</span></p>

<p><span></span>xVariableNames[1] +=&nbsp;"park" &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;#produce&nbsp;"lnsqrtpark&nbsp;"</p>

<p>xVariableNames[2] = <span>xIsLogPrefix</span></p>

<p>xVariableNames[2] +=&nbsp;<span>xIsVolatilityPrefix</span></p>

<p>xVariableNames[2] +=&nbsp;"rr" &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;#produce "lnsqrtrr"</p>

<p>&nbsp;</p>

<p># finally, make a list of variables based on their names</p>

<p>list &nbsp; &nbsp;xVariables =  <at> xVariableNames[1]  <at> xVariableNames[2]</p>

<div><br></div>
<p><span>The last line produces an error Im unable to graps</span>. Is there a workaround or do I need to have a different script for each dataset? As an additional question, can I somehow get the name of currently opened dataset? If yes, xIsLog and xIsVolatility could be set automatically and it would make the script much more elegant.&nbsp;</p>

<p>&nbsp;</p>

<p>Thank you and best regards,&nbsp;</p>

<p>Daniel</p>

<p>&nbsp;</p>
</div>
Daniel Bencik | 4 Jan 14:08 2015
Picon

Re: Saving model to session programatically

Henrique, thank you much. Daniel
 

_______________________________________________
Gretl-users mailing list
Gretl-users <at> lists.wfu.edu
http://lists.wfu.edu/mailman/listinfo/gretl-users

Gmane