logpoissonRE.predict {glmmAK} | R Documentation

## Prediction for Poisson log-linear regression with random effects

### Description

This function compute predictive (expected) counts for specified combinations of covariates. It is based on the MCMC output obtained using `logpoissonRE`.

### Usage

    logpoissonRE.predict(nobs, x, xb, offset, cluster,
          intcpt.random=FALSE, hierar.center=FALSE,
          drandom=c("normal", "gspline"),
          betaF, betaR, varR, is.varR=TRUE,
          prior.gspline,
          probs, values=FALSE,
          dir=getwd(), wfile, indfile, header=TRUE, logw, is.indfile,
          skip=0, nwrite)

### Arguments

`nobs` | number of covariate combinations for which we want to perform a prediction
`x` | covariate combinations for which we want to perform a prediction. It should have the same structure as in `logpoissonRE` used to obtain the MCMC output
`xb` | covariate combinations for which we want to perform a prediction. It should have the same structure as in `logpoissonRE` used to obtain the MCMC output
`offset` | optional offset vector.
`cluster` | vector defining pertinence of the single observations to clusters. It is useful when we want to predict longitudinal profiles. See also the same argument in `logpoissonRE`.
`intcpt.random` | see the same argument in `logpoissonRE`
`hierar.center` | see the same argument in `logpoissonRE`
`drandom` | see the same argument in `logpoissonRE`
`betaF` | sampled values of the fixed effects. This should be a (sub)sample from the MCMC output stored in the file ‘betaF.sim’
`betaR` | sampled values of the mean of random effects. This should be a (sub)sample from the MCMC output stored in the file ‘betaR.sim’ It is only needed if `hierar.center` is `TRUE`.
`varR` | sampled values of either (co)variance matrices or precision (matrices) for random effects if there are any. This should be a (sub)sample of either the first or second half of the columns stored in the file ‘varR.sim’
`is.varR` | logical indicating whether `varR` gives (co)variance (`is.varR` `TRUE`) or precisions (inverse variances) (`is.varR` `FALSE`)
`prior.gspline` | if `drandom` is gspline this is a list specifying the G-splines. It should have the same structure as the same argument in `logpoissonRE` used to obtain the MCMC output. However, it is satisfactory if the items K, delta and sigma are given.
`probs` | probabilities for which the (pointwise) sample quantiles of the predictive counts should be computed. If not given only average (and values) of the predictive counts are computed
`values` | if `TRUE` also values of the predictive counts at each (MCMC) iteration are returned. If `FALSE` only sample mean (and quantiles) of the predictive probabilities are returned
`dir` | character giving the directory where the file with (sampled) G-spline (log-)weights is stored. Needed only if `drandom` is gspline.
`wfile` | character giving the name of the file with (sampled) G-spline (log-)weights. Needed only if `drandom` is gspline. In most cases, for univariate G-spline this argument will be equal to “`logweight.sim`” and for bivariate G-spline equal to “`weight.sim`”.
`indfile` | character giving the name of the file where we stored indeces of these G-spline components for which the weights are stored in the file given by `wfile`. The corresponding file should have the same structure as ‘knotInd.sim’ created by `logpoissonRE`. Needed only if `is.indfile` is `TRUE`. In most cases, for univariate G-spline it does not have to be specified and for bivariate G-spline it will be equal to “`knotInd.sim`”.
`header` | logical indicating whether the files `wfile`, `indfile` contain a header. Needed only if `drandom` is gspline.
`logw` | logical indicating whether the file `wfile` contains logarithms of the weights. Needed only if `drandom` is gspline. In most cases, for univariate G-spline it will be `TRUE` and for bivariate G-spline it will be `FALSE`.
`is.indfile` | logical. If `TRUE` then `wfile` contains only the non-zero weights and the G-spline is reconstructed using `indfile`. If `FALSE` then `wfile` must contain on each row weights of all components and `indfile` is ignored. Needed only if `drandom` is gspline and random effects are bivariate.
`skip` | number of data rows that should be skipped at the beginning of the files `wfile`, `indfile`.
`nwrite` | frequency with which is the user informed about the progress of computation (every `nwrite`th iteration count of iterations change)

### Value

A list with the following components (description below applies for the case with `prob=0.5`)

`Mean` | a matrix with 1 column giving in each row posterior predictive mean of the count E(Y) for a given covariate combination.
`50%` | a matrix with 1 column giving in each row posterior predictive quantile (here 50% quantile) of the count for a given covariate combination. There is one component of this type in the resulting `list` for each value of `probs`.
`values` | a matrix with n columns, where n denotes the number of covariate combinations for which we perform the prediction, and number of rows equal to the length of the MCMC. Each column gives sampled counts a given covariate combination. It is returned only if `values` is `TRUE`.

### Author(s)

Arnošt Komárek arnost.komarek[AT]mff.cuni.cz

### References

Komárek, A. and Lesaffre, E. (2008). Generalized linear mixed model with a penalized Gaussian mixture as a random-effects distribution. Computational Statistics and Data Analysis, 52, 3441–3458.

### See Also

`logpoissonRE`, `logpoisson`, `glm`.

[Package glmmAK version 1.3-1 Index]