[Rd] StructTS (PR#7353)

maechler at stat.math.ethz.ch maechler at stat.math.ethz.ch
Tue Nov 9 12:33:44 CET 2004


>>>>> "Claus" == Claus Dethlefsen <dethlef at math.aau.dk>
>>>>>     on Tue,  9 Nov 2004 08:39:22 +0100 (CET) writes:

    Claus> Dear R-bugs

(whom did you mean? :-)

    Claus> I have been studying the StructTS function (in
    Claus> package 'stats') and functions supplied with it. I
    Claus> think I have found a few minor bugs in the
    Claus> documentation.

    Claus> I am referring to the version of StructTS supplied with the release R 2.0.0.

    ....

    Claus> 1) In the help page under "fixed" it is explained (file:
    Claus> R-2.0.0/src/library/stats/man/StructTS.Rd): 

    Claus> "If supplied, only non-\code{NA} entries in
    Claus> \code{fixed} will be varied."

    Claus> Either I misunderstand this or there may be a bug in
    Claus> the documentation. As I understand it, setting fixed
    Claus> to the value, eg. c(NA,0,NA,NA) sets the variance of
    Claus> the slope component to 0 and varies the other
    Claus> variances to find the maximum likelihood
    Claus> estimates. If I am right, I suggest the docs changed
    Claus> to: "If supplied, only \code{NA} entries in
    Claus> \code{fixed} will be varied."  ("non-" has been
    Claus> deleted).

yes. thank you.  You are entirely correct.

    Claus> E.g. try the following after invoking R:

    R> StructTS(log10(UKgas), type = "BSM", fixed=c(0,NA,NA,NA))

    Claus> Observe, that the first variance is fixed to zero,
    Claus> while the remaining three are varied to obtain the
    Claus> maximum likelihood estimates.


    Claus> 2) There is a minor typo in the explanation of 'fitted' - a parenthesis is
    Claus> missing. I suggest changing
    Claus> "(that is at time \eqn{t} and not at the end of the series."
    Claus> to
    Claus> "(that is at time \eqn{t} and not at the end of the series)."

indeed, thank you.


    Claus> 3) In the documentation, one of the values returned in the list is called
    Claus> "convergence", while in the code, it is called "code". I suggest either to
    Claus> change the documentation from
    Claus> "\item{convergence}{the value returned by \code{\link{optim}}.}"
    Claus> to
    Claus> "\item{code}{the value returned by \code{\link{optim}}.}"

    Claus> or to change the code.

Changing the code has the potential to break other code relying on
StrucTS()   {and we are in deep-freeze for R 2.0.1}
--> I'm changing the documentation.


    Claus> Thank you for supplying a great set of functions.

and thank you for the bug report!
Martin Maechler, ETH Zurich



More information about the R-devel mailing list