Thank you both a lot. I was out of my mind to overlook the +/- thing. Thank you also for
the exp() trick, so far I thought the only way to ensure positiveness is to formulate a
model for log(Rng).
Best regards,
Daniel
______________________________________________________________
> Od: gretl-users-request(a)lists.wfu.edu
> Komu: <gretl-users(a)lists.wfu.edu>
> Datum: 22.02.2012 13:48
> Předmět: Gretl-users Digest, Vol 61, Issue 17
>
>Send Gretl-users mailing list submissions to
> gretl-users(a)lists.wfu.edu
>
>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(a)lists.wfu.edu
>
>You can reach the person managing the list at
> gretl-users-owner(a)lists.wfu.edu
>
>When replying, please edit your Subject line so it is more specific
>than "Re: Contents of Gretl-users digest..."
>
>
>Today's Topics:
>
> 1. CARR model MLE ( Dan B?so? )
> 2. Re: CARR model MLE (Allin Cottrell)
> 3. Re: CARR model MLE (Riccardo (Jack) Lucchetti)
> 4. Re: Bootstrap VAR models (alexkakashi(a)libero.it)
> 5. Problem with bootstrap result (alexkakashi(a)libero.it)
>
>
>----------------------------------------------------------------------
>
>Message: 1
>Date: Tue, 21 Feb 2012 21:15:02 +0100
>From: " Dan B?so? " <eubie(a)centrum.cz>
>Subject: [Gretl-users] CARR model MLE
>To: <gretl-users(a)lists.wfu.edu>
>Message-ID: <20120221211502.4991D432(a)centrum.cz>
>Content-Type: text/plain; charset=UTF-8
>
>
>Dear fellow users,
>
>I am trying to write a script for MLE estimation of a CARR model, similar to GARCH. It
is a MEM model in daily ranges of some instrument, i,e,
>
>Eq. 1: lRng = lambda * epsilon # epsilon is exponentially distributed here, giving
the shape of LL
>Eq. 2: lambda = a + b*Rng(-1) + c*lambda(-1)
>
>I tried the following code but the algorithm never converges. What should I improve?
>Thanks in advance, Daniel
>
>
>
>scalar a = 0.1
>scalar b = 0.4
>scalar c = 0.4
>
>mle ll = -ln(lambda) + Rng/lambda
>
> series lambda = mean(Rng)
> series lambda = a + b*Rng(-1) + c*lambda(-1)
>
> params a b c
>end mle
>
>
>
>------------------------------
>
>Message: 2
>Date: Tue, 21 Feb 2012 15:57:19 -0500 (EST)
>From: Allin Cottrell <cottrell(a)wfu.edu>
>Subject: Re: [Gretl-users] CARR model MLE
>To: Gretl list <gretl-users(a)lists.wfu.edu>
>Message-ID:
> <alpine.LNX.2.01.1202211548120.22658(a)waverley.dhcp.wfu.edu>
>Content-Type: text/plain; charset="iso-8859-2"
>
>On Tue, 21 Feb 2012, Dan B?so? wrote:
>
>> I am trying to write a script for MLE estimation of a CARR model, similar to
GARCH. It is a MEM model in daily ranges of some instrument, i,e,
>>
>> Eq. 1: lRng = lambda * epsilon # epsilon is exponentially distributed here,
giving the shape of LL
>> Eq. 2: lambda = a + b*Rng(-1) + c*lambda(-1)
>>
>> I tried the following code but the algorithm never
>> converges. What should I improve?
>
>> scalar a = 0.1
>> scalar b = 0.4
>> scalar c = 0.4
>>
>> mle ll = -ln(lambda) + Rng/lambda
>
>Improve here: use the correct loglikelihood!
>
> mle ll = -ln(lambda) - Rng/lambda
>
>> series lambda = mean(Rng)
>> series lambda = a + b*Rng(-1) + c*lambda(-1)
>>
>> params a b c
>> end mle
>
>You may also have to constrain all the parameter values to be
>positive, if I'm reading the CARR literature correctly. In
>which case you could, for example, express lambda as
>exp(a) + exp(b)*Rng(-1) + exp(c)*lambda(-1).
>
>Allin Cottrell
>
>------------------------------
>
>Message: 3
>Date: Tue, 21 Feb 2012 22:25:59 +0100 (CET)
>From: "Riccardo (Jack) Lucchetti" <r.lucchetti(a)univpm.it>
>Subject: Re: [Gretl-users] CARR model MLE
>To: Gretl list <gretl-users(a)lists.wfu.edu>
>Message-ID: <alpine.DEB.2.02.1202212216510.14044(a)ec-4.econ.univpm.it>
>Content-Type: text/plain; charset="utf-8"
>
>On Tue, 21 Feb 2012, Allin Cottrell wrote:
>
>> On Tue, 21 Feb 2012, Dan B?so? wrote:
>>
>>> I am trying to write a script for MLE estimation of a CARR model, similar
>>> to GARCH. It is a MEM model in daily ranges of some instrument, i,e,
>>>
>>> Eq. 1: lRng = lambda * epsilon # epsilon is exponentially distributed
>>> here, giving the shape of LL
>>> Eq. 2: lambda = a + b*Rng(-1) + c*lambda(-1)
>>>
>>> I tried the following code but the algorithm never converges. What should I
>>> improve?
>>
>>> scalar a = 0.1
>>> scalar b = 0.4
>>> scalar c = 0.4
>>>
>>> mle ll = -ln(lambda) + Rng/lambda
>>
>> Improve here: use the correct loglikelihood!
>>
>> mle ll = -ln(lambda) - Rng/lambda
>>
>>> series lambda = mean(Rng)
>>> series lambda = a + b*Rng(-1) + c*lambda(-1)
>>>
>>> params a b c
>>> end mle
>>
>> You may also have to constrain all the parameter values to be positive, if
>> I'm reading the CARR literature correctly. In which case you could, for
>> example, express lambda as
>> exp(a) + exp(b)*Rng(-1) + exp(c)*lambda(-1).
>
>Alternatively, you can wrap everything up into a function so that checking
>is done automatically inside the function, as in
>
><hansl>
>function series CarrLoglik(series y, matrix theta)
> if minc(theta)<0
> series ret = NA
> else
> scalar a = theta[1]
> scalar b = theta[2]
> scalar c = theta[3]
> series lambda = mean(y)
> series lambda = a + b * y(-1) + c * lambda(-1)
> series ret = -ln(lambda) - y/lambda
> endif
>
> return ret
>end function
>
>param = {0.1;0.4;0.4}
>
>mle ll = CarrLoglik(Rng, theta)
> params theta
>end mle
></hansl>
>
>
>Riccardo (Jack) Lucchetti
>Dipartimento di Economia
>Universit? Politecnica delle Marche
>
>r.lucchetti(a)univpm.it
>http://www.econ.univpm.it/lucchetti
>
>------------------------------
>
>Message: 4
>Date: Wed, 22 Feb 2012 11:37:33 +0100 (CET)
>From: "alexkakashi(a)libero.it" <alexkakashi(a)libero.it>
>Subject: Re: [Gretl-users] Bootstrap VAR models
>To: <gretl-users(a)lists.wfu.edu>
>Message-ID:
> <9682170.1207401329907053657.JavaMail.defaultUser@defaultHost>
>Content-Type: text/plain;charset="UTF-8"
>
>Thanks Stev.
>
>I have used this procedure to study Granger causality from X to Y in a
>trivariate VAR:
>
>r=158 ## number of observation
>
>ysim=Y
>
>xsim=X
>
>Zsim=Z
>
>system method=sur
>equation Y const Y(-1) Y(-2) Z(-1) Z(-2)
>equation X const Y(-1) Y(-2) X(-1) X(-2) Z(-1) Z(-2)
>equation Z const Y(-1) Y(-2) X(-1) X(-2) Z(-1) Z(-2)
>end system
>
>genr residui=$uhat
>
>genr M=$coeff
>
>loop for i=3..r --quiet
>
>ysim[i]=M[1]+M[2]*ysim[i-1]+M[3]*ysim[i-2]+M[4]*zsim[i-1]+M[5]*zsim[i-2]
>
>xsim[i]=M[6]+M[7]*ysim[i-1]+M[8]*ysim[i-2]+M[9]*xsim[i-1]+M[10]*xsim[i-2]+M[11]
>*zsim[i-1]+M[12]*zsim[i-2]
>
>zsim[i]=M[13]+M[14]*ysim[i-1]+M[15]*ysim[i-2]+M[16]*xsim[i-1]+M[17]*xsim[i-2]+M
>[18]*zsim[i-1]+M[19]*zsim[i-2]
>
>loop replics --quiet ### BOOTSTRAP
>
>smpl full
>
>Ysim=ysim
>
>Xsim=xsim
>
>Zsim=zsim
>
>genr A=resample(residui)
>
>loop for i=3..r --quiet
>
>Ysim[i]=ysim[i]+A[i-2,1]
>
>Xsim[i]=ysim[i]+A[i-2,2]
>
>Zsim[i]=ysim[i]+A[i-2,3]
>
>endloop
>
>...................endloop
>
>There is a strange result when I apply the bootstrap procedure. In fact the
>statistic test based on observed data is very large, but the bootstrap p-value
>is greater then 0.8 and I do not reject the null hypothesis of Granger non-
>causality from X to Y. The results are different if I work considering only the
>equation
>
>equation Y const Y(-1) Y(-2) X(-1) X(-2) Z(-1) Z(-2)
>
>Under the null hypothesis I replace the series Y. In this case the bootstrap p-
>value is very small and I reject the null hypothesis of no-causality. I don't
>understant the different between these p-values.
>
>Best regards.
>
>Alessandro
>
>
>
>>----Messaggio originale----
>>Da: gretl-users-request(a)lists.wfu.edu
>>Data: 16/02/2012 18.00
>>A: <gretl-users(a)lists.wfu.edu>
>>Ogg: Gretl-users Digest, Vol 61, Issue 11
>>
>>Send Gretl-users mailing list submissions to
>> gretl-users(a)lists.wfu.edu
>>
>>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(a)lists.wfu.edu
>>
>>You can reach the person managing the list at
>> gretl-users-owner(a)lists.wfu.edu
>>
>>When replying, please edit your Subject line so it is more specific
>>than "Re: Contents of Gretl-users digest..."
>>
>>
>>Today's Topics:
>>
>> 1. Bootstrap VAR models (alexkakashi(a)libero.it)
>> 2. Re: Bootstrap VAR models (Sven Schreiber)
>> 3. Gretl error/crash ((s) Simon Grenville-Wood)
>> 4. Re: Gretl error/crash (Riccardo (Jack) Lucchetti)
>> 5. Re: Gretl error/crash ((s) Simon Grenville-Wood)
>> 6. Random-effects panel-data (Helgi Tomasson)
>>
>>
>>----------------------------------------------------------------------
>>
>>Message: 1
>>Date: Thu, 16 Feb 2012 09:34:37 +0100 (CET)
>>From: "alexkakashi(a)libero.it" <alexkakashi(a)libero.it>
>>Subject: [Gretl-users] Bootstrap VAR models
>>To: gretl-users(a)lists.wfu.edu
>>Message-ID: <25986877.1523161329381277575.JavaMail.root@wmail22>
>>Content-Type: text/plain;charset="UTF-8"
>>
>>Hi,
>>
>>I have the following question. Let us consider a trivariate VAR model. The
>>parameters of the model are estimated using:
>>
>>system method=sur
>>equation Y const Y(-1) X(-1) Z(-1)
>>equation X const Y(-1) X(-1) Z(-1)
>>equation Z const Y(-1) X(-1) Z(-1)
>>end system
>>
>>I'd like study Granger causality from X to Y and the critical values are
>>calculated using bootstrap method based on residuals. Is this procedure
>>implemented in gretl?
>>
>>Best regards.
>>
>>Alessandro
>>
>>
>>------------------------------
>>
>>Message: 2
>>Date: Thu, 16 Feb 2012 10:18:44 +0100
>>From: Sven Schreiber <svetosch(a)gmx.net>
>>Subject: Re: [Gretl-users] Bootstrap VAR models
>>To: gretl-users(a)lists.wfu.edu
>>Message-ID: <4F3CC9F4.4050602(a)gmx.net>
>>Content-Type: text/plain; charset=ISO-8859-1
>>
>>On 02/16/2012 09:34 AM, alexkakashi(a)libero.it wrote:
>>> Hi,
>>>
>>> I have the following question. Let us consider a trivariate VAR model. The
>>> parameters of the model are estimated using:
>>>
>>> system method=sur
>>> equation Y const Y(-1) X(-1) Z(-1)
>>> equation X const Y(-1) X(-1) Z(-1)
>>> equation Z const Y(-1) X(-1) Z(-1)
>>> end system
>>>
>>> I'd like study Granger causality from X to Y and the critical values are
>>> calculated using bootstrap method based on residuals. Is this procedure
>>> implemented in gretl?
>>>
>>
>>
>>Not that I know of, but have a look at the varsimul() and resample()
>>functions, with those it's not too difficult to program it.
>>
>>hth,
>>sven
>>
>>
>>------------------------------
>>
>>Message: 3
>>Date: Thu, 16 Feb 2012 14:50:11 +0000
>>From: "(s) Simon Grenville-Wood"
>> <simon.grenville-wood(a)students.plymouth.ac.uk>
>>Subject: [Gretl-users] Gretl error/crash
>>To: "gretl-users(a)lists.wfu.edu" <gretl-users(a)lists.wfu.edu>
>>Message-ID:
>> <A775801493FD6643B49F9B292B0376FB2F63D3CC(a)AMSPRD0302MB113.eurprd03.prod.
>outlook.com>
>>
>>Content-Type: text/plain; charset="iso-8859-1"
>>
>>Hi,
>>
>>I'm currently attempting a multinomial logit model on a large sample of panel
>data.
>>I'm having a problem where I need to be able to create dummies for each
>individual in the sample to control for the individual fixed effects.
>>
>>In order to do so while using the logit model, I need to dummify the person
>ID (PID) in the sample.
>>I've opened the gretl console and I enter the following commands:
>>
>>discrete PID <----transform the variable, 19,421 values, to be discrete
>>dummify PID <----create dummies for each individual to control for fixed
>effects
>>
>>The last command causes gretl to crash, giving a libcairo_32.dll error. This
>happens on whichever computer I am using. Occasionally, if I use the menus
>instead of the console, it will give an 'out of memory' error. My PC is
>definitely sufficiently powerful.
>>
>>Does anyone have any ideas as to how I can get around this issue?
>>
>>Thanks,
>>
>>Simon
>>