Re: [R] Calculating AIC for the whole model in VAR

2013-05-21 Thread Prof Brian Ripley

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,  rip...@stats.ox.ac.uk
Professor of Applied Statistics,  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, UKFax:  +44 1865 272595

__
R-help@r-project.org 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.


Re: [R] Calculating AIC for the whole model in VAR

2013-05-21 Thread Dimitri Liakhovitski
Sorry, I am using package vars


On Tue, May 21, 2013 at 11:09 AM, Prof Brian Ripley
rip...@stats.ox.ac.ukwrote:

 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,  rip...@stats.ox.ac.uk
 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, UKFax:  +44 1865 272595




-- 
Dimitri Liakhovitski

[[alternative HTML version deleted]]

__
R-help@r-project.org 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.


Re: [R] Calculating AIC for the whole model in VAR

2013-05-21 Thread Prof Brian Ripley

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
rip...@stats.ox.ac.uk mailto:rip...@stats.ox.ac.uk 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, rip...@stats.ox.ac.uk mailto:rip...@stats.ox.ac.uk
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
tel:%2B44%201865%20272861 (self)
1 South Parks Road, +44 1865 272866 tel:%2B44%201865%20272866 (PA)
Oxford OX1 3TG, UKFax: +44 1865 272595
tel:%2B44%201865%20272595




--
Dimitri Liakhovitski



--
Brian D. Ripley,  rip...@stats.ox.ac.uk
Professor of Applied Statistics,  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, UKFax:  +44 1865 272595

__
R-help@r-project.org 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.


Re: [R] Calculating AIC for the whole model in VAR

2013-05-21 Thread Dimitri Liakhovitski
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
rip...@stats.ox.ac.ukwrote:

 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
 rip...@stats.ox.ac.uk mailto:rip...@stats.ox.ac.uk** 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, rip...@stats.ox.ac.uk mailto:rip...@stats.ox.ac.uk
 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, UKFax: +44 1865 272595
 tel:%2B44%201865%20272595




 --
 Dimitri Liakhovitski



 --
 Brian D. Ripley,  rip...@stats.ox.ac.uk
 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, UKFax:  +44 1865 272595




-- 
Dimitri Liakhovitski

[[alternative HTML version deleted]]

__
R-help@r-project.org 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.


Re: [R] Calculating AIC for the whole model in VAR

2013-05-21 Thread Bernhard Pfaff
Am Dienstag, den 21.05.2013, 16:17 +0100 schrieb Prof Brian Ripley: 
 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.
 
Dear Prof. Ripley,

many thanks for pointing this out. The attributes 'df' and 'nobs' have
been added to logLik.varest() on R-Forge (project 'AICTS II', revision
= 90); soon to be released on CRAN (package version 1.5-1).

Best,
Bernhard

 
 
  On Tue, May 21, 2013 at 11:09 AM, Prof Brian Ripley
  rip...@stats.ox.ac.uk mailto:rip...@stats.ox.ac.uk 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, rip...@stats.ox.ac.uk mailto:rip...@stats.ox.ac.uk
  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
  tel:%2B44%201865%20272861 (self)
  1 South Parks Road, +44 1865 272866 tel:%2B44%201865%20272866 (PA)
  Oxford OX1 3TG, UKFax: +44 1865 272595
  tel:%2B44%201865%20272595
 
 
 
 
  --
  Dimitri Liakhovitski
 


__
R-help@r-project.org 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.