update.hmm.discnp: Update a fitted 'hmm.discnp' model.

View source: R/update.hmm.discnp.R

update.hmm.discnpR Documentation

Update a fitted hmm.discnp model.

Description

An update() method for objects of class hmm.discnp.

Usage

## S3 method for class 'hmm.discnp'
update(object,..., data, Kplus1=FALSE,
        tpm2=NULL, verbose=FALSE, method=NULL, optimiser=NULL,
        stationary=NULL, mixture=NULL, cis=NULL, tolerance=NULL,
        itmax=NULL, crit=NULL, X=NULL, addIntercept=NULL)

Arguments

object

An object of class hmm.discnp as returned by hmm().

...

Not used.

data

The data set to which the (updated) model is to be fitted. See the description of the y argument of hmm() for more detail.

Kplus1

Logical scalar. Should the number of states be incremented by 1? If so then tpm (the transition probability matrix) is re-formed by rbind()-ing on a row all of whose entries are 1/K (where K is the “old” number of states) and then cbind()-ing on a column of zeroes. The emission probability matrix Rho is reformed by cbind()-ing on a column all of whose entries are 1/m where m is the number of discrete values of the emissions.

Note that the intial likelihood of the “new” model with K+1 states will (should?) be exactly the same as that of of the “old” fitted K-state model.

The Kplus1 argument is provided mainly so as to provide a set of starting values for the fitting process which will guarantee the log likelihood of a K+1-state model will be at least as large as that of a K-state model fitted to the same data set.

Experience indicates that when Kplus1=TRUE is used, the fitting process does not “move very far” from the maximum log likelihood found for the K-state model. It is then advisable to try (many) random starting values so as to (try to) find the “true” maximum for the K+1-state model.

tpm2

The transtion probability matrix to use when updating a model fitted with K=1 and Kplus1=TRUE. This argument is ignored otherwise. The default value of this argument is matrix(0.5,2,2). The value of tpm2 makes no difference to the initial value of the likelihood of the K=2 model (which will be identical to the likelihood of the fitted K=1 model that is being updated). Any two-by-two transition probability matrix “will do”. However the value of tpm2 could conceivably have an impact on the final likelihood of the K=2 model to which the fitting procedure converges. This is particularly true if the method is (or is switched to) "LM".

verbose

See the help for hmm().

method

See the help for hmm().

optimiser

See the help for hmm().

stationary

See the help for hmm().

mixture

See the help for hmm().

cis

See the help for hmm().

tolerance

See the help for hmm().

itmax

See the help for hmm().

crit

See the help for hmm().

X

See the help for hmm().

addIntercept

See the help for hmm().

Details

Except for argument X, any arguments that are left NULL have their values supplied from the args component of object.

Value

An object of class hmm.discnp with an additional component init.log.like which is the initial log likelihood calculated at the starting values of the parameters (which may be modified from the parameters returned in the object being updated, if Kplus1 is TRUE). The calculation is done by the function logLikHmm(). Barring the strange and unforeseen, init.log.like should be (reassuringly) equal to object$log.like. See hmm() for details of the other components of the returned value.

Author(s)

Rolf Turner r.turner@auckland.ac.nz

See Also

hmm() rhmm.hmm.discnp()

Examples

set.seed(294)
fit  <- hmm(WoodPeweeSong,K=2,rand.start=list(tpm=TRUE,Rho=TRUE),itmax=10)
xxx  <- rhmm(fit,nsim=1)
sfit <- update(fit,data=xxx,itmax=10)
yyy  <- with(SydColDisc,split(y,f=list(locn,depth)))
f1   <- hmm(yyy,K=1)
f2   <- update(f1,data=yyy,Kplus1=TRUE) # Big improvement, but ...
## Not run: 
g2   <- hmm(yyy,K=2) # Substantially better than f2. 

## End(Not run)

hmm.discnp documentation built on Sept. 26, 2022, 5:05 p.m.