On Tue, 20 Mar 2012, Sven Schreiber wrote:
On 03/20/2012 10:13 PM, Allin Cottrell wrote:
> On Tue, 20 Mar 2012, Daniel Bencik wrote:
>> I humbly ask you for help with hopefully the last problem.
>> I would like to estimate an AR(1)-GARCH(1,1) model with T-distributed normalized
residuals. I take the loglik function from
and transform everything into code.
>> # allRng[t] = c + a1*allRng[t-1] + e[t]
>> scalar c = 0.1
>> scalar a1 = 0.1
>> # e[t] = h[t] * Student[t]
>> # GARCH - h[t] = cg + ga*h[t-1] + arc*e^2[t-1]
>> scalar cg = 0.1
>> scalar ga = 0.1
>> scalar arc = 0.1
>> scalar dof = 4
>> mle ll = log(gammafun((dof + 1)/2)) - log(gammafun(dof/2)) - 0.5*log(dof-2) -
log(h) # - 0.5*(dof + 1)*log(1 + (dof - 2)^(-1)*h^(-2)*e^2)
>> series e = 0
>> series e = allRng - c - a1*allRng(-1) #AR1 process
>> series h = var(allRng)
> This is a type error: given a series argument, the var()
> function returns a scalar result, namely the variance of the
Hm, that's also what I thought at first when I looked at it. However:
- basically the same approach is in the manual (Jan 2012): p. 147 at the
bottom, with var(y)
- doesn't the 'series' command in this case coerce the scalar value to a
Doh! Yes, you're right. Sorry for the noise.
- could the error message be made more helpful? (according to OP it
mentions the variable ll)
I'll take a look at that, but it's probably difficult to
reconstruct the particular error without more context.