8

The Time Series package for Mathematica comes with a function called LogLikelihood. It is discussed and used extensively in the documentation (pdf). So does Mathematica 8. First I though my inability to use LogLikelihood was that it was being shadowed by the LogLikelihood function in Mathematica itself, but apparently not.

Loading the package with

Needs["TimeSeries`TimeSeries`"]

works for every other function, but the only LogLikelihoodfunction I have access to is Mathematica's built in one. Trying to refere to it with the full context, like so

TimeSeries`TimeSeries`LogLikelihood

doesn't work either. It is as if this one function simply isn't there. I've also tried re-downloading the package and reinstalling in case I got a corrupt version the first time around, but this hasn't helped.

EDIT: The way I am calling the function should be correct:

data = TimeSeries[ARModel[{0.5, -0.2}, 1], 20]
(*{0.775171, -0.0377616, -0.568652, 1.56771, 1.32269, -1.60302, \
-1.53275, 0.127154, 1.37393, 0.138493, -0.0484376, -0.506817, \
0.731963, 2.28373, 0.374458, 0.468365, 2.48781, 1.24375, 1.0746, \
-0.401619}*)

LogLikelihood[data, ARModel[{0.5}, 1]]
(*LogLikelihood[{0.775171, -0.0377616, -0.568652, 1.56771, 
  1.32269, -1.60302, -1.53275, 0.127154, 1.37393, 
  0.138493, -0.0484376, -0.506817, 0.731963, 2.28373, 0.374458, 
  0.468365, 2.48781, 1.24375, 1.0746, -0.401619}, ARModel[{0.5}, 1]]*)

EDIT2: Using full context in calling the function has the same result:

TimeSeries`TimeSeries`LogLikelihood[data, ARModel[{0.5}, 1]]
(*LogLikelihood[{0.775171, -0.0377616, -0.568652, 1.56771, 
  1.32269, -1.60302, -1.53275, 0.127154, 1.37393, 
  0.138493, -0.0484376, -0.506817, 0.731963, 2.28373, 0.374458, 
  0.468365, 2.48781, 1.24375, 1.0746, -0.401619}, ARModel[{0.5}, 1]]*)

EDIT3: This is the context path:

$ContextPath
(*{"TimeSeries`TimeSeries`", "PacletManager`", "WebServices`", \
"System`", "Global`"}*)
Mr Alpha
  • 3,156
  • 2
  • 24
  • 33
  • @Szabolcs I was looking for that the other day. Instead, I accidentally removed both Global` and System` from my $ContextPath, and things went a little weird. :) – rcollyer May 21 '12 at 13:54
  • So, trying out those solution it appears that my problem is something else entirely, since when I load the Time Series package it is the package LogLikelihoodfunction that I can't access, even when using the full context in referring to it. – Mr Alpha May 21 '12 at 14:56
  • 4
    To those who vote(d) to delete: I think it would make much more sense to keep this as another gateway to the same common problem. – Leonid Shifrin May 21 '12 at 15:06
  • 3
    @MrAlpha If you could add your new findings to your question I feel this makes for a completely new situation. The other questions have answers that mostly assume that using the full name should resolve the shadowing problem, which doesn't appear to be the case in your situation. Could you retry this first on a freshly started system, just to be sure? A complication is that Time Series isn't a standard package, so I'm not sure how many of us would be able to duplicate what you found. After updating please flag for moderator attention. – Sjoerd C. de Vries May 21 '12 at 20:27
  • In your edit, you're not using the full context call... – Sjoerd C. de Vries May 22 '12 at 14:08
  • I don't have this package, so I don't know what it looks like and whether the source code is accessible. But it would be worth a try to search all files in the package for the string LogLikelihood and see what you get. (BTW I'm deleting my now irrelevant first comment.) – Szabolcs May 22 '12 at 14:28
  • Two more things to try: is the name TimeSeries`TimeSeries` really on the context path or is it perhaps just TimeSeries`? Could you try an exact example from the documentation, for instance the one on page 80? – Sjoerd C. de Vries May 22 '12 at 14:29
  • @Szabolcs I thought about doing that but I don't even know where the files are. The package comes in form of a .exe installer. No install path or anything. – Mr Alpha May 22 '12 at 15:01
  • @SjoerdC.deVries I've exactly tried several of the examples from the documents, including the one on page 80. None work. – Mr Alpha May 22 '12 at 15:04
  • @MrAlpha My guess is that it's either in $UserBaseDirectory (per user install) or $BaseDirectory (install for all users). (Within the Applications subdir of these, of course.) You can check $InstallationDirectory as well, but I hope it's not there ... it'd get wiped with a resintall ... FindFile will help too, e.g. FindFile["Combinatorica`"] tells me where Combinatorica lives. – Szabolcs May 22 '12 at 15:05
  • @Szabolcs Thank you. I found it in the $BaseDirectory. After browsing through the code I also managed to figure out what the problem is. Apparently they've renamed the function, they just haven't bothered to update the documentation. – Mr Alpha May 22 '12 at 15:16
  • @MrAlpha If you solved the problem, could you post an answer detailed enough to be useful for anyone else who hits the same problem? (And you can accept the answer.) – Szabolcs May 22 '12 at 15:22

1 Answers1

7

Wolfram has renamed the LogLikelihood function in the Time Series package to LogLikelihoodFunction. But they have apparently forgotten to update the documentation.

Mr Alpha
  • 3,156
  • 2
  • 24
  • 33