rhglmm.default {hglmm}R Documentation

Simulate data from a hidden generalized linear Markov model.

Description

Takes an object specifying the structure of the data frame in which the data are to be stored, and the parameters of the model and simulates the data.

Usage

## Default S3 method:
rhglmm(object,formula,cells, miss.frac = 0,
                         contr = NULL, ...) 

Arguments

object

An object with components tpm (the transition probability matrix of the hidden Markov chain), phi (the coefficients of the linear predictor of the generalized linear model), data (a data frame determining the structure of the simulated data), and ispd (an optional specification of the initial state probability distribution — if this component is not present in object then it is calculated from tpm).

formula

The formula specifying the generalized linear model to be simulated from. Note that this formula should include state, a factor specifying the state of the hidden Markov chain. Note also that this formula must be compatible with the vector phi of model coefficients provided in object. It is the user's responsibility to ensure this compatibility.

cells

A character vector specifying the names of the factors which determine the “cells” of the model.

miss.frac

Data will be randomly set equal to NA with probability miss.frac.

contr

A character string, one of “treatment”, “helmert” or “sum”, specifying what contrasts to use in constructing the design matrix. Note that the meaning of the coefficient vector phi depends on the contrasts specified, so make sure that the contrasts are the same as what you had in mind when you specified phi!!!

...

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 data and also the simulated response whose name is determined from formula.

Author(s)

Rolf Turner r.turner@auckland.ac.nz

References

See the help for hglmm() for references.

See Also

fitted.hglmm() rhglmm() rhglmm.hglmm() bcov()

Examples

  # See the help for rhglmm() for an example.

[Package hglmm version 0.0-14 Index]