Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

getResidualCor.gllvm

Extract residual correlations from gllvm object


Description

Calculates the residual correlation matrix for gllvm model.

Usage

## S3 method for class 'gllvm'
getResidualCor(object, adjust = 1)

Arguments

object

an object of class 'gllvm'.

adjust

The type of adjustment used for negative binomial and binomial distribution when computing residual correlation matrix. Options are 0 (no adjustment), 1 (the default adjustment) and 2 (alternative adjustment for NB distribution). See details.

Details

Residual correlation matrix is calculated based on the residual covariance matrix, see details from getResidualCov.gllvm.

Author(s)

Francis K.C. Hui, Jenni Niku, David I. Warton

Examples

#'# Extract subset of the microbial data to be used as an example
data(microbialdata)
y <- microbialdata$Y[, order(colMeans(microbialdata$Y > 0), 
                     decreasing = TRUE)[21:40]]
fit <- gllvm(y, family = poisson())
fit$logL
cr <- getResidualCor(fit)
cr[1:5,1:5]
## Not run: 
# Load a dataset from the mvabund package
data(antTraits)
y <- as.matrix(antTraits$abund)
# Fit gllvm model
fit <- gllvm(y = y, family = poisson())
# residual correlations:
cr <- getResidualCor(fit)
# Plot residual correlations:
install.packages("corrplot", "gclus")
library(corrplot)
library(gclus)
corrplot(cr[order.single(cr), order.single(cr)], diag = F,
  type = "lower", method = "square", tl.cex = 0.8, tl.srt = 45, tl.col = "red")
  
## End(Not run)

gllvm

Generalized Linear Latent Variable Models

v1.3.0
GPL-2
Authors
Jenni Niku [aut, cre], Wesley Brooks [aut], Riki Herliansyah [aut], Francis K.C. Hui [aut], Sara Taskinen [aut], David I. Warton [aut], Bert van der Veen [aut]
Initial release
2021-4-26

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.