fitted.eglhmm {eglhmm} | R Documentation |
Predict method for extended generalised linear hidden Markov models.
Description
Predicted values based on an extended generalised linear hidden Markov model object.
Usage
## S3 method for class 'eglhmm'
fitted(object, ...)
Arguments
object |
An object of class |
... |
Not used. |
Value
A vector of fitted values of the same length as that of the
observed values (i.e. length equal to the row dimension of the
data frame to which the model was fitted. This data frame is
equal to object$data
but with repeated rows corresponding to
different states collapsed to a single row. The row dimension of
this data frame is thus nrow(object$data)/K
where K
is the number of states in the model. This data frame, with
columns cf
and state
omitted, is returned as an
attribute data
of the vector of fitted values.
Remark
Although this documentation refers to “generalised linear models”, the only such models currently (13/02/2024) available are the Gaussian model with the identity link, the Poisson model, with the log link, and the Binomial model with the logit link. Other models may be added at a future date.
Author(s)
Rolf Turner rolfturner@posteo.net
References
See the help for eglhmm()
for references.
See Also
reglhmm()
reglhmm.default()
reglhmm.eglhmm()
bcov()
Examples
loc4 <- c("LngRf","BondiE","BondiOff","MlbrOff")
SCC4 <- SydColCount[SydColCount$locn %in% loc4,]
SCC4$locn <- factor(SCC4$locn) # Get rid of unused levels.
rownames(SCC4) <- 1:nrow(SCC4)
fit <- eglhmm(y~locn+depth,data=SCC4,cells=c("locn","depth"),
K=2,distr="P",contr="sum",verb=TRUE)
fv <- fitted(fit)
with(attr(fv,"data"),plot(y[locn=="BondiOff" & depth=="40"],
xlab="time",ylab="count"))
with(attr(fv,"data"),lines(fv[locn=="BondiOff" & depth=="40"]))