rhglmm.hglmm {hglmm}R Documentation

Simulate data from a hidden generalized linear Markov model which has been fitted to a data set.

Description

Given an object of class hglmm simulates data from the model specified by that object.

Usage

## S3 method for class 'hglmm'
rhglmm(object, miss.frac = NULL,
                       set.con = TRUE, ...)

Arguments

object

An object of class hglmm as produced by hglmm().

miss.frac

Data will be randomly set equal to NA with probability miss.frac. By default its value is taken to be the value of object$miss.frac, so if the latter is non-zero and you want miss.frac to be 0, you must specify this explicitly.

set.con

Logical scalar. Should the contrasts to use when building the design matrix be set? You should probably never set this to FALSE yourself. Note that if rhglmm() is called by bcov(), then set.con will be set to FALSE, because the setting of the contrasts will already have been done by bcov().

...

Not used.

Details

Although the name refers to “generalized linear models”, currently only log linear Poisson models are provided for. More flexibility may be added at a future date.

Value

A data frame with the same columns as those of object$data but with columns cf and state omitted and 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. The response column is replaced by the simulated response. The name of the response is determined from object$formula.

Author(s)

Rolf Turner r.turner@auckland.ac.nz

References

See the help for hglmm() for references.

See Also

fitted.hglmm() rhglmm() rhglmm.default() 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 <- hglmm(y~locn+depth,SCC4,c("locn","depth"),K=2,
                 contr="sum",verb=TRUE)
    Y   <- rhglmm(fit)

[Package hglmm version 0.0-14 Index]