predict.micore: Get predicted OTU abundances

Description Usage Arguments Value Examples

View source: R/methods.R

Description

Get predicted OTU abundances

Usage

1
2
3
4
5
6
7
8
9
## S3 method for class 'micore'
predict(
  object,
  newdata = NULL,
  type = c("alr", "proportion"),
  post.stat = c("mean", "median"),
  quant = c(0.025, 0.975),
  ...
)

Arguments

object

An object of class micore

newdata

An optional numeric matrix containing covariates for new observations to get predictions for.

type

Character specifying what scale to get predicted OTU abundances for. Additive log-ratios or proportions?

post.stat

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

quant

Numeric vector specifying the quantiles of the posterior to return for the OTU abundances.

...

Further arguments passed to or from other methods

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))
pred <- predict(mc.fit, newdata = new.dat)

pred.p <- predict(mc.fit, newdata=new.dat, "prop")

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