Description Usage Arguments Value Examples
Get the predicted covariance matrix based on the micore
model fit. Can also
return correlation, precision, and partial correlation matrices.
1 2 3 4 5 6 7 |
obj |
An object of class |
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. |
A list containing:
fit
: A matrix containing the posterior mean (or median) of the covariance matrix.
quant
: A list containing the requested quantiles from the posterior mean for the covariance matrix.
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")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.