getPredCov: Get the predicted covariance matrix based on the 'micore'...

Description Usage Arguments Value Examples

View source: R/methods.R

Description

Get the predicted covariance matrix based on the micore model fit. Can also return correlation, precision, and partial correlation matrices.

Usage

1
2
3
4
5
6
7
getPredCov(
  obj,
  newdata = NULL,
  quant = c(0.025, 0.975),
  type = c("cov", "cor", "prec", "pcor"),
  post.stat = c("mean", "median")
)

Arguments

obj

An object of class micore.

newdata

n optional numeric matrix containing covariates for new observations to get predicted covariance matrices for.

quant

Numeric vector specifying the quantiles of the posterior to return for predicted covariances.

type

Type of matrix to return: covariance, correlation, precision, or partial correlation.

post.stat

Character specifying whether the predictions be based on the posterior mean or median.

Value

A list containing:

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
n <- 50
p <- 5
X <- cbind(1, rnorm(n))
counts <- matrix(0, n, p+1)
for (i in 1:n) {
  counts[i,] <- rmultinom(1, size=100, prob=rep(1,p+1))
}

library(micore)
mc.fit <- micore(counts, X, n.samp=100, n.burn=100, n.chain=1)

new.dat <- cbind(c(1,1,1),c(0,1,0))

c.mat <- getPredCov(mc.fit, new.dat)
pc.mat <- getPredCov(mc.fit, new.dat, type="pcor")

kevinmcgregor/micore documentation built on June 9, 2021, 10:29 p.m.