Here is a reproducible example:
library(vars)
data("Canada")
mymodel <- VAR(Canada, p = 2, type = "const")
myLL<-logLik(mymodel)
AIC(myLL)
Why does logLik(mymodel) say that df=NULL?
Might this be the reason for AIC(myLL) being numeric(0)?
Dimitri
On Tue, May 21, 2013 at 11:17 AM, Prof Brian Ripley
<[email protected]>wrote:
> On 21/05/2013 16:11, Dimitri Liakhovitski wrote:
>
>> Sorry, I am using package "vars"
>>
>
> So you need to report the bug in that package to its maintainer. ?logLik
> says
>
> Value:
>
> Returns an object of class logLik. This is a number with at
> least one attribute, "df" (*d*egrees of *f*reedom), giving the
> number of (estimated) parameters in the model.
>
> and the methods in vars do not comply.
>
>
>>
>> On Tue, May 21, 2013 at 11:09 AM, Prof Brian Ripley
>> <[email protected] <mailto:[email protected]>**> wrote:
>>
>> On 21/05/2013 16:00, Dimitri Liakhovitski wrote:
>>
>> Hello!
>>
>> I am using package "VAR".
>>
>>
>> What is that? There is no such package on CRAN nor BioC.
>>
>>
>> I've fitted my model:
>> mymodel<-VAR(mydata,myp,type="**__const")
>>
>>
>> I can extract the Log Liklihood for THE WHOLE MODEL:
>>
>> logLik(mymodel)
>>
>> How could I calculate (other than manually) the corresponding
>> Akaike
>> Information Criterion (AIC)?
>>
>> I tried AIC - but it does not take mymodel:
>> AIC(mymodel)
>> # numeric(0)
>>
>> Thank you!
>>
>>
>> This is not reproducible, pace the posting guide. The default
>> method for AIC() should work if the logLik() method is written
>> correctly, so I guess it was not.
>>
>> --
>> Brian D. Ripley, [email protected] <mailto:[email protected]>
>> Professor of Applied Statistics,
>>
>> http://www.stats.ox.ac.uk/~__**ripley/<http://www.stats.ox.ac.uk/~__ripley/>
>>
>> <http://www.stats.ox.ac.uk/~**ripley/<http://www.stats.ox.ac.uk/~ripley/>
>> >
>> University of Oxford, Tel: +44 1865 272861
>> <tel:%2B44%201865%20272861> (self)
>> 1 South Parks Road, +44 1865 272866 <tel:%2B44%201865%20272866> (PA)
>>
>> Oxford OX1 3TG, UK Fax: +44 1865 272595
>> <tel:%2B44%201865%20272595>
>>
>>
>>
>>
>> --
>> Dimitri Liakhovitski
>>
>
>
> --
> Brian D. Ripley, [email protected]
> Professor of Applied Statistics,
> http://www.stats.ox.ac.uk/~**ripley/<http://www.stats.ox.ac.uk/~ripley/>
> University of Oxford, Tel: +44 1865 272861 (self)
> 1 South Parks Road, +44 1865 272866 (PA)
> Oxford OX1 3TG, UK Fax: +44 1865 272595
>
--
Dimitri Liakhovitski
[[alternative HTML version deleted]]
______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.